-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias #27021
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
Conversation
@@ -646,11 +646,11 @@ PyTypeObject Py_GenericAliasType = { | |||
PyObject * | |||
Py_GenericAlias(PyObject *origin, PyObject *args) | |||
{ | |||
gaobject *alias = PyObject_GC_New(gaobject, &Py_GenericAliasType); | |||
gaobject *alias = (gaobject*) PyType_GenericAlloc( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyType_GenericAlloc()
calls _PyObject_GC_Malloc()
instead of PyObject_GC_New()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_PyObject_GC_New
calls _PyObject_GC_Malloc
+ _PyObject_Init
, which PyType_GenericAlloc
also calls. What I am missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right then.
Please fix also ga_new()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ga_new
doesn't seem to need the fix. It uses tp_alloc
which is set to PyType_GenericAlloc
.
@@ -646,11 +646,11 @@ PyTypeObject Py_GenericAliasType = { | |||
PyObject * | |||
Py_GenericAlias(PyObject *origin, PyObject *args) | |||
{ | |||
gaobject *alias = PyObject_GC_New(gaobject, &Py_GenericAliasType); | |||
gaobject *alias = (gaobject*) PyType_GenericAlloc( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right then.
Please fix also ga_new()
.
Co-authored-by: Serhiy Storchaka <[email protected]>
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
* bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias * Update Objects/genericaliasobject.c Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]> (cherry picked from commit b324c4c) Co-authored-by: Pablo Galindo <[email protected]>
GH-27031 is a backport of this pull request to the 3.10 branch. |
* bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias * Update Objects/genericaliasobject.c Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]> (cherry picked from commit b324c4c) Co-authored-by: Pablo Galindo <[email protected]>
https://bugs.python.org/issue44562