mirror of
https://github.com/python/cpython.git
synced 2025-09-05 00:11:10 +00:00
tp_new_wrapper(): A subtle change in the check for safe use.
Allow staticbase != type, as long as their tp_new slots are the same.
This commit is contained in:
parent
f21c6be7bd
commit
a8c60f478c
1 changed files with 1 additions and 1 deletions
|
@ -2303,7 +2303,7 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
staticbase = subtype;
|
||||
while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE))
|
||||
staticbase = staticbase->tp_base;
|
||||
if (staticbase != type) {
|
||||
if (staticbase->tp_new != type->tp_new) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%s.__new__(%s) is not safe, use %s.__new__()",
|
||||
type->tp_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue