-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE
can now inherit the vectorcall protocol
#27001
Conversation
cc. @pablogsal |
Py_TPFLAGS_IMMUTABLETYPE
to decide if vectorcall type flags can be inheritedPy_TPFLAGS_IMMUTABLETYPE
can now implement the vectorcall protocol
Re-opening to trigger CI. |
Misc/NEWS.d/next/Core and Builtins/2021-07-03-00-20-39.bpo-43908.YHuV_s.rst
Outdated
Show resolved
Hide resolved
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.
LGTM
It would be great if @vstinner could take a look as he has been dealing with this heavily recently. If he cannot review in a week or so, ping me again and I will merge :)
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.
LGTM. But to be able to merge this change, please move the news entry to Doc/whatsnew/3.10.rst. I suggest to backport this nice enhancement to Python 3.10.
Ok, moved to 3.10 in commit 6adc9e5. Thanks for reviewing, Pablo & Victor! 🙏🏻 |
Is this considered a bugfix? We are very close to RC 1 so I'm not sure we should risk regressions... |
I guess it depends on how you view it:
|
But this is something only happens in the stdlib, and those types are not going to change between beta 4 and RC 1. User types are not going to become magically heap types. I'm missing something? |
No, that's correct. If vectorcall support is not going to be added to any stdlib type in 3.10, there's no reason to backport this. |
Sounds like a backport is out of the question, then. |
Ah, I didn't notice that there are two months between the RC1 and the final versions. Ok, so this change should not be backported. |
Misc/NEWS.d/next/Core and Builtins/2021-07-03-00-20-39.bpo-43908.YHuV_s.rst
Show resolved
Hide resolved
Py_TPFLAGS_IMMUTABLETYPE
can now implement the vectorcall protocolPy_TPFLAGS_IMMUTABLETYPE
can now inherit the vectorcall protocol
Misc/NEWS.d/next/Core and Builtins/2021-07-03-00-20-39.bpo-43908.YHuV_s.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Victor Stinner <vstinner@python.org>
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.
LGTM. Thanks, the NEWS entry is now crystal clear.
@@ -710,7 +710,7 @@ and :c:type:`PyType_Type` effectively act as defaults.) | |||
|
|||
.. warning:: | |||
|
|||
It is not recommended for :ref:`heap types <heap-types>` to implement | |||
It is not recommended for :ref:`mutable heap types <heap-types>` to implement |
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.
Note: It's non-obvious what "mutable" means. It would be nice to add (in a separated PR) a new "Immutable types" section near https://docs.python.org/dev/c-api/typeobj.html#heap-types to explain the effects of the Py_TPFLAGS_IMMUTABLETYPE flag and explains that static types get this flag automatically.
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.
I agree. I'll see if I can find time for it. Thanks again for reviewing!
Py_TPFLAGS_HAVE_VECTORCALL
andPy_TPFLAGS_METHOD_DESCRIPTOR
inheritance is now ruled by the
Py_TPFLAGS_IMMUTABLETYPE
flag insteadof the
Py_TPFLAGS_HEAPTYPE
flag.https://bugs.python.org/issue43908