10000 gh-107810: Improve DeprecationWarning for metaclasses with custom tp_new by cdce8p · Pull Request #107834 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107810: Improve DeprecationWarning for metaclasses with custom tp_new #107834

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

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

cdce8p
Copy link
Contributor
@cdce8p cdce8p commented Aug 10, 2023

Thanks @Eclips4 for the idea!
If accepted, it would be great if this change could be backported to 3.12. If not into 3.12.0, than 3.12.1.

As example, for protobuf the warning would change as such

-<frozen importlib._bootstrap>:400
-    DeprecationWarning: Using PyType_Spec with metaclasses that have custom tp_new is deprecated and will no longer be allowed in Python 3.14.

+<frozen importlib._bootstrap>:400:
+    DeprecationWarning: Type google._upb._message.MessageMapContainer uses PyType_Spec with metaclasses that have custom tp_new is deprecated and will no longer be allowed in Python 3.14.

@cdce8p cdce8p requested a review from markshannon as a code owner August 10, 2023 09:19
@cdce8p cdce8p changed the title gh-107810: Improve DeprecationWarning for PyType_Spec gh-107810: Improve DeprecationWarning for metaclasses with custom tp_new Aug 10, 2023
@Eclips4 Eclips4 requested a review from encukou August 10, 2023 10:35
Copy link
Member
@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

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

LGTM. Let's wait for the Petr's opinion.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
@encukou
Copy link
Member
encukou commented Aug 10, 2023

Thank you for the PR!

The wording looks weird to me though. Could you split it to two sentences, one about the concrete type and one about the behaviour being deprecated?

"Type %s uses PyType_Spec with a metaclass that has custom "
"tp_new. This is deprecated and will no longer be allowed in "
"Python 3.14."

@encukou encukou enabled auto-merge (squash) August 10, 2023 15:14
@encukou encukou merged commit 16dcce2 into python:main Aug 10, 2023
@cdce8p cdce8p deleted the improve-deprecationWarning branch August 10, 2023 15:59
@cdce8p
Copy link
Contributor Author
cdce8p commented Aug 10, 2023

@encukou Can this be backported to 3.12?

@bedevere-bot

This comment was marked as off-topic.

@Eclips4
Copy link
Member
Eclips4 commented Aug 10, 2023

Buildbot failure unrelated.

@Yhg1s Yhg1s added the needs backport to 3.12 only security fixes label Aug 11, 2023
@miss-islington
Copy link
Contributor

Thanks @cdce8p for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-107864 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Aug 11, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2023
…om tp_new (pythonGH-107834)

(cherry picked from commit 16dcce2)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Yhg1s pushed a commit that referenced this pull request Aug 11, 2023
…tom tp_new (GH-107834) (#107864)

gh-107810: Improve DeprecationWarning for metaclasses with custom tp_new (GH-107834)

(cherry picked from commit 16dcce2)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
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.

6 participants
0