From a4acf1ff847f072b2035bbb02c9af5496e59d6d6 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Mon, 18 Jan 2016 21:17:54 -0800 Subject: [PATCH] set tp_new from the class in the hierarchy that actually owns the descriptor (closes #25731) Debugging by Eryk Sun. --- Objects/typeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 8a5623f879..baee1f1ad2 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6239,7 +6239,7 @@ update_one_slot(PyTypeObject *type, slotdef *p) sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - specific = (void *)type->tp_new; + specific = (void *)((PyTypeObject *)PyCFunction_GET_SELF(descr))->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- 2.50.1