Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE can now inherit the vectorcall protocol#27001
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
erlend-aasland commented Jul 2, 2021 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland commented Jul 2, 2021
cc. @pablogsal |
Py_TPFLAGS_IMMUTABLETYPE to decide if vectorcall type flags can be inheritedPy_TPFLAGS_IMMUTABLETYPE can now implement the vectorcall protocolerlend-aasland commented Jul 5, 2021
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 resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
pablogsal left a comment
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 :)
vstinner left a comment
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.
erlend-aasland commented Jul 6, 2021
Ok, moved to 3.10 in commit 6adc9e5. Thanks for reviewing, Pablo & Victor! 🙏🏻 |
pablogsal commented Jul 6, 2021
Is this considered a bugfix? We are very close to RC 1 so I'm not sure we should risk regressions... |
erlend-aasland commented Jul 6, 2021
I guess it depends on how you view it:
|
pablogsal commented Jul 6, 2021
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? |
erlend-aasland commented Jul 6, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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. |
erlend-aasland commented Jul 6, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Sounds like a backport is out of the question, then. |
vstinner commented Jul 6, 2021
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.rstShow resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Py_TPFLAGS_IMMUTABLETYPE can now implement the vectorcall protocolPy_TPFLAGS_IMMUTABLETYPE can now inherit the vectorcall protocolMisc/NEWS.d/next/Core and Builtins/2021-07-03-00-20-39.bpo-43908.YHuV_s.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <[email protected]>
vstinner left a comment
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.
| .. 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_VECTORCALLandPy_TPFLAGS_METHOD_DESCRIPTORinheritance is now ruled by the
Py_TPFLAGS_IMMUTABLETYPEflag insteadof the
Py_TPFLAGS_HEAPTYPEflag.https://bugs.python.org/issue43908