Kaydet (Commit) a8c60f47 authored tarafından Guido van Rossum's avatar Guido van Rossum

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.
üst f21c6be7
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment