[issue43228] Regression in function builtins

STINNER Victor report at bugs.python.org
Wed Feb 17 12:47:07 EST 2021


STINNER Victor <vstinner at python.org> added the comment:

I wrote _testinernalcapi.get_builtins() function to help me debuging this issue:

diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c
index ab6c5965d1..250ecc61ab 100644
--- a/Modules/_testinternalcapi.c
+++ b/Modules/_testinternalcapi.c
@@ -279,6 +279,14 @@ test_atomic_funcs(PyObject *self, PyObject *Py_UNUSED(args))
 }
 
 
+static PyObject*
+get_builtins(PyObject *self, PyObject *obj)
+{
+    PyFunctionObject *func = (PyFunctionObject *)obj;
+    return Py_NewRef(func->func_builtins);
+}
+
+
 static PyMethodDef TestMethods[] = {
     {"get_configs", get_configs, METH_NOARGS},
     {"get_recursion_depth", get_recursion_depth, METH_NOARGS},
@@ -289,6 +297,7 @@ static PyMethodDef TestMethods[] = {
     {"get_config", test_get_config, METH_NOARGS},
     {"set_config", test_set_config, METH_O},
     {"test_atomic_funcs", test_atomic_funcs, METH_NOARGS},
+    {"get_builtins", get_builtins, METH_O},
     {NULL, NULL} /* sentinel */
 };

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43228>
_______________________________________


More information about the Python-bugs-list mailing list