summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-14 17:54:38 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-14 17:54:38 (GMT)
commit386072ebe02b54eb9fb303031c769bef094967f5 (patch)
tree3acfd0fae8d3510ee5a82e4624b70bd3d6e47366 /Objects
parente88ed05006d4eef73e550149efa5ec11c6336dcc (diff)
parent49010ee323eca5d6f5264f046ec1954d818fd5a7 (diff)
downloadcpython-386072ebe02b54eb9fb303031c769bef094967f5.zip
cpython-386072ebe02b54eb9fb303031c769bef094967f5.tar.gz
cpython-386072ebe02b54eb9fb303031c769bef094967f5.tar.bz2
Merge from 3.6.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 96444ae..329261b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6878,34 +6878,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. */
- PyObject *self = PyCFunction_GET_SELF(descr);
- if (!self || !PyType_Check(self)) {
- /* This should never happen because
- tp_new_wrapper expects a type for self.
- Use slot_tp_new which will call
- tp_new_wrapper which will raise an
- exception. */
- specific = (void *)slot_tp_new;
- }
- else {
- PyTypeObject *staticbase;
- specific = ((PyTypeObject *)self)->tp_new;
- /* Check that the user does not do anything
- silly and unsafe like object.__new__(dict).
- To do this, we check that the most derived
- base that's not a heap type is this type. */
- staticbase = type->tp_base;
- while (staticbase &&
- (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE))
- staticbase = staticbase->tp_base;
- if (staticbase &&
- staticbase->tp_new != specific)
- /* Seems to be unsafe, better use
- slot_tp_new which will call
- tp_new_wrapper which will raise an
- exception if it is unsafe. */
- specific = (void *)slot_tp_new;
- }
+ specific = (void *)type->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