gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386)

This commit is contained in:
Petr Viktorin 2023-06-12 17:45:49 +02:00 committed by GitHub
parent 58f0bda341
commit 2b90796be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 9 deletions

View file

@ -4236,7 +4236,7 @@ _PyType_FromMetaclass_impl(
metaclass);
goto finally;
}
if (metaclass->tp_new != PyType_Type.tp_new) {
if (metaclass->tp_new && metaclass->tp_new != PyType_Type.tp_new) {
if (_allow_tp_new) {
if (PyErr_WarnFormat(
PyExc_DeprecationWarning, 1,