]> granicus.if.org Git - python/commitdiff
tp_new_wrapper(): A subtle change in the check for safe use.
authorGuido van Rossum <guido@python.org>
Fri, 14 Sep 2001 19:43:36 +0000 (19:43 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 14 Sep 2001 19:43:36 +0000 (19:43 +0000)
Allow staticbase != type, as long as their tp_new slots are the same.

Objects/typeobject.c

index 52fd7e9b731ecfce5ec0f2cfa023003585000460..2a9ef71b5486cd56d91601fe1edf3aa3356aa076 100644 (file)
@@ -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,