bpo-42423: Accept single base class in PyType_FromModuleAndSpec() (GH-23441)

This commit is contained in:
Serhiy Storchaka 2020-11-22 13:25:02 +02:00 committed by GitHub
parent c4d45ee670
commit 686c203cd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 28 deletions

View file

@ -2993,8 +2993,9 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
}
}
else if (!PyTuple_Check(bases)) {
PyErr_SetString(PyExc_SystemError, "bases is not a tuple");
goto fail;
bases = PyTuple_Pack(1, bases);
if (!bases)
goto fail;
}
else {
Py_INCREF(bases);