@@ -5652,6 +5652,42 @@ test_macros(PyObject *self, PyObject *Py_UNUSED(args))
56525652 Py_RETURN_NONE ;
56535653}
56545654
5655+ static PyObject *
5656+ function_get_code (PyObject * self , PyObject * func )
5657+ {
5658+ PyObject * code = PyFunction_GetCode (func );
5659+ if (code != NULL ) {
5660+ Py_INCREF (code );
5661+ return code ;
5662+ } else {
5663+ return NULL ;
5664+ }
5665+ }
5666+
5667+ static PyObject *
5668+ function_get_globals (PyObject * self , PyObject * func )
5669+ {
5670+ PyObject * globals = PyFunction_GetGlobals (func );
5671+ if (globals != NULL ) {
5672+ Py_INCREF (globals );
5673+ return globals ;
5674+ } else {
5675+ return NULL ;
5676+ }
5677+ }
5678+
5679+ static PyObject *
5680+ function_get_module (PyObject * self , PyObject * func )
5681+ {
5682+ PyObject * module = PyFunction_GetModule (func );
5683+ if (module != NULL ) {
5684+ Py_INCREF (module );
5685+ return module ;
5686+ } else {
5687+ return NULL ;
5688+ }
5689+ }
5690+
56555691
56565692static PyObject * test_buildvalue_issue38913 (PyObject * , PyObject * );
56575693static PyObject * getargs_s_hash_int (PyObject * , PyObject * , PyObject * );
@@ -5935,6 +5971,9 @@ static PyMethodDef TestMethods[] = {
59355971 {"watch_dict" , watch_dict , METH_VARARGS , NULL },
59365972 {"unwatch_dict" , unwatch_dict , METH_VARARGS , NULL },
59375973 {"get_dict_watcher_events" , get_dict_watcher_events , METH_NOARGS , NULL },
5974+ {"function_get_code" , function_get_code , METH_O , NULL },
5975+ {"function_get_globals" , function_get_globals , METH_O , NULL },
5976+ {"function_get_module" , function_get_module , METH_O , NULL },
59385977 {NULL , NULL } /* sentinel */
59395978};
59405979
0 commit comments