Skip to content

Conversation

@encukou
Copy link
Member

@encukouencukou commented Jul 20, 2021

  • Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG

    The field is always present in the type struct, as explained
    in the added comment.

  • Remove Py_TPFLAGS_HAVE_AM_SEND

    The flag is not needed, and since it was added in 3.10 it can be removed now.

https://bugs.python.org/issue42747

Automerge-Triggered-By: GH:encukou

The field is always present in the type struct, as explained in the added comment.
The flag is not needed.
@pablogsal
Copy link
Member

How this flag was added and when it was turned into a no-op?

@encukou
Copy link
MemberAuthor

encukou commented Jul 20, 2021

Py_TPFLAGS_HAVE_* flags have been historically added whenever a new field was added to the type struct, to make it possible to use extensions compiled for earlier Python versions (where the fields aren't present).
But extensions need to be recompiled for each feature version (as long I can remember, and definitely in Python 3.0+), or use the stable ABI (where types use the interpreter's memory layout).

This PR turns both into no-ops, as they should be.
One of the removed code paths probably has an issue, see bpo-44588 -- but I didn't investigate that deeper yet.

@@ -0,0 +1,4 @@
The ``Py_TPFLAGS_HAVE_VERSION_TAG`` type flag now does nothing. The
``Py_TPFLAGS_HAVE_AM_SEND`` flag (which was added in 3.10) is removed. Both
Copy link
Member

Choose a reason for hiding this comment

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

Py_TPFLAGS_HAVE_AM_SEND flag (which was added in 3.10) is removed.

there aren't many users use it?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

If there any users of it, they are using the 3.10 betas. Requiring that they remove the flag is fair game.

@miss-islingtonmiss-islington merged commit a4760cc into python:mainJul 23, 2021
@miss-islington
Copy link
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-27306 is a backport of this pull request to the 3.10 branch.

@encukouencukou deleted the remove-unnecessary-tpflags branch July 23, 2021 13:21
@bedevere-botbedevere-bot removed the needs backport to 3.10 only security fixes label Jul 23, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2021
…RSION_TAG no-op (pythonGH-27260) * Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG The field is always present in the type struct, as explained in the added comment. * Remove Py_TPFLAGS_HAVE_AM_SEND The flag is not needed, and since it was added in 3.10 it can be removed now. (cherry picked from commit a4760cc) Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou added a commit that referenced this pull request Jul 23, 2021
…RSION_TAG no-op (GH-27260) (GH-27306) * Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG The field is always present in the type struct, as explained in the added comment. * Remove Py_TPFLAGS_HAVE_AM_SEND The flag is not needed, and since it was added in 3.10 it can be removed now. (cherry picked from commit a4760cc) Co-authored-by: Petr Viktorin <encukou@gmail.com>
@vstinner
Copy link
Member

Thanks for this fix @encukou. The rationale for Py_TPFLAGS_HAVE_AM_SEND was unclear. Now it's well defined, it's useless :-D

Sign up for freeto 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.

8 participants

@encukou@pablogsal@miss-islington@bedevere-bot@vstinner@corona10@shihai1991@the-knights-who-say-ni