From a8c60f478cfadf9d75d605816f3962fbe588640a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 14 Sep 2001 19:43:36 +0000 Subject: [PATCH] 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. --- Objects/typeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 52fd7e9b731..2a9ef71b548 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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,