@@ -5658,6 +5658,42 @@ test_macros(PyObject *self, PyObject *Py_UNUSED(args))
56585658 Py_RETURN_NONE ;
56595659}
56605660
5661+ static PyObject *
5662+ function_get_code (PyObject * self , PyObject * func )
5663+ {
5664+ PyObject * code = PyFunction_GetCode (func );
5665+ if (code != NULL ) {
5666+ Py_INCREF (code );
5667+ return code ;
5668+ } else {
5669+ return NULL ;
5670+ }
5671+ }
5672+
5673+ static PyObject *
5674+ function_get_globals (PyObject * self , PyObject * func )
5675+ {
5676+ PyObject * globals = PyFunction_GetGlobals (func );
5677+ if (globals != NULL ) {
5678+ Py_INCREF (globals );
5679+ return globals ;
5680+ } else {
5681+ return NULL ;
5682+ }
5683+ }
5684+
5685+ static PyObject *
5686+ function_get_module (PyObject * self , PyObject * func )
5687+ {
5688+ PyObject * module = PyFunction_GetModule (func );
5689+ if (module != NULL ) {
5690+ Py_INCREF (module );
5691+ return module ;
5692+ } else {
5693+ return NULL ;
5694+ }
5695+ }
5696+
56615697
56625698static PyObject * test_buildvalue_issue38913 (PyObject * , PyObject * );
56635699static PyObject * getargs_s_hash_int (PyObject * , PyObject * , PyObject * );
@@ -5942,6 +5978,9 @@ static PyMethodDef TestMethods[] = {
59425978 {"watch_dict" , watch_dict , METH_VARARGS , NULL },
59435979 {"unwatch_dict" , unwatch_dict , METH_VARARGS , NULL },
59445980 {"get_dict_watcher_events" , get_dict_watcher_events , METH_NOARGS , NULL },
5981+ {"function_get_code" , function_get_code , METH_O , NULL },
5982+ {"function_get_globals" , function_get_globals , METH_O , NULL },
5983+ {"function_get_module" , function_get_module , METH_O , NULL },
59455984 {NULL , NULL } /* sentinel */
59465985};
59475986
0 commit comments