FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-43908: Types with `Py_TPFLAGS_IMMUTABLETYPE ` can now inherit the vectorcall protocol by erlend-aasland · Pull Request #27001 · python/cpython · GitHub

Repository navigation

bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE can now inherit the vectorcall protocol - #27001

Merged
vstinner merged 15 commits into
python:mainfrom
erlend-aasland:vectorcall-inheritance
Jul 8, 2021
Merged

vstinner merged 15 commits into
python:mainfrom
erlend-aasland:vectorcall-inheritance

Conversation

erlend-aasland commented Jul 2, 2021 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Py_TPFLAGS_HAVE_VECTORCALL and Py_TPFLAGS_METHOD_DESCRIPTOR
inheritance is now ruled by the Py_TPFLAGS_IMMUTABLETYPE flag instead
of the Py_TPFLAGS_HEAPTYPE flag.

https://bugs.python.org/issue43908

Copy link
Copy Markdown
Contributor Author

cc. @pablogsal

erlend-aasland changed the title bpo-43908: Use Py_TPFLAGS_IMMUTABLETYPE to decide if vectorcall type flags can be inherited bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE can now implement the vectorcall protocol Jul 2, 2021
erlend-aasland reopened this Jul 5, 2021

Copy link
Copy Markdown
Contributor Author

Re-opening to trigger CI.

pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor Author

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! 🙏🏻

Copy link
Copy Markdown
Member

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.

Is this considered a bugfix? We are very close to RC 1 so I'm not sure we should risk regressions...

Copy link
Copy Markdown
Contributor Author

Is this considered a bugfix?

I guess it depends on how you view it:

  1. <some-type> used to be a static type before 3.10; now it's a heap type, and has hence lost the option of adding vectorcall support => bug! :)
  2. immutable heap types can now implement the vectorcall protocol => (micro) feature! :)

Copy link
Copy Markdown
Member

now it's a heap type

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

Copy link
Copy Markdown
Contributor Author

now it's a heap type

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.

erlend-aasland commented Jul 6, 2021 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Sounds like a backport is out of the question, then.
I'll revert the last commit and remove the label.
I've reverted 6adc9e5 and removed the backport label.

vstinner commented Jul 6, 2021

Copy link
Copy Markdown
Member

@pablogsal:

Is this considered a bugfix? We are very close to RC 1 so I'm not sure we should risk regressions...

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.

erlend-aasland changed the title bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE can now implement the vectorcall protocol bpo-43908: Types with Py_TPFLAGS_IMMUTABLETYPE can now inherit the vectorcall protocol Jul 6, 2021
Erlend Egeberg Aasland and others added 2 commits July 7, 2021 20:54
erlend-aasland requested a review from vstinner July 7, 2021 18:57

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Thanks, the NEWS entry is now crystal clear.

Comment thread Doc/c-api/typeobj.rst
.. 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I agree. I'll see if I can find time for it. Thanks again for reviewing!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL