-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-94673: Ensure Builtin Static Types are Readied Properly #103940
gh-94673: Ensure Builtin Static Types are Readied Properly #103940
Conversation
674427b
to
143f936
Compare
This causes a regression for some users of PyTypeObject MyType = {
PyObject_HEAD_INIT(NULL)
/* ... */
};
int MyType_Add(PyObject *m)
{
int err;
PyObject *obj = PyLong_FromDouble(1.0);
if (!obj)
return -1;
MyType.tp_dict = PyDict_New();
if (!type->tp_dict) {
Py_DECREF(obj);
return -1;
}
err = PyDict_SetItemString(MyType.tp_dict, "foo", obj);
Py_DECREF(obj);
if (err)
return err;
if (PyModule_AddType(m, &MyType))
return -1;
return 0;
} but now this will now segfault, as
with no mention of
As |
Workaround for [1]. [1] python/cpython#103940 Signed-off-by: Sean Anderson <seanga2@gmail.com>
There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.