Skip to content
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

gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL #105386

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

encukou
Copy link
Member

@encukou encukou commented Jun 6, 2023

It would be safe, and useful in some cases, to allow creating types whose metaclass has tp_new=NULL (i.e. the metaclass can't be instantiated from Python).

@Yhg1s, is it OK to backport this to 3.12? (No rush, sorry for bothering you on release day.)
It relaxes a check that newly raises DeprecationWarning in 3.12 (or TypeError from a function that's new in 3.12). It's one line in Objects/typeobject.c, the rest are tests/docs.


📚 Documentation preview 📚: https://cpython-previews--105386.org.readthedocs.build/

@Yhg1s
Copy link
Member

Yhg1s commented Jun 7, 2023

Yes, since it's just relaxing an overly strict check, if we can get it into beta 3 this'd be fine.

@encukou encukou merged commit 2b90796 into python:main Jun 12, 2023
@miss-islington
Copy link
Contributor

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

@encukou encukou deleted the fromspec-tpnew-null branch June 12, 2023 15:45
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 12, 2023
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jun 12, 2023
encukou added a commit that referenced this pull request Jun 12, 2023
…=NULL (GH-105386) (GH-105697)

gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386)
(cherry picked from commit 2b90796)

Co-authored-by: Petr Viktorin <[email protected]>
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.

4 participants