cpython: 3c9512d8ac0d (original) (raw)
Mercurial > cpython
changeset 99975:3c9512d8ac0d 3.5
set tp_new from the class in the hierarchy that actually owns the descriptor (closes #25731) Debugging by Eryk Sun. [#25731]
Benjamin Peterson benjamin@python.org | |
---|---|
date | Mon, 18 Jan 2016 21:11:18 -0800 |
parents | 673d1ccea050 |
children | a7953ee29f1c bf997b22df06 |
files | Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_descr.py 8 Misc/NEWS 2 Objects/typeobject.c 2 |
line wrap: on
line diff
--- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4564,6 +4564,14 @@ order (MRO) for bases """ self.assertRegex(repr(method), r"<bound method qualname of <object object at .*>>")
- def test_deleting_new_in_subclasses(self):
class X:[](#l1.8)
def __init__(self, a):[](#l1.9)
pass[](#l1.10)
X.__new__ = None[](#l1.11)
del X.__new__[](#l1.12)
X(1) # should work[](#l1.13)
+ class DictProxyTests(unittest.TestCase): def setUp(self):
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Release date: tba Core and Builtins ----------------- +- Issue #25731: Fix set and deleting new on a class. +
- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in _PyObject_GetState() due to regressions observed in Cython-based projects.
--- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6777,7 +6777,7 @@ update_one_slot(PyTypeObject *type, slot sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */
specific = (void *)type->tp_new;[](#l3.7)
specific = (void *)((PyTypeObject *)PyCFunction_GET_SELF(descr))->tp_new;[](#l3.8) /* XXX I'm not 100% sure that there isn't a hole[](#l3.9) in this reasoning that requires additional[](#l3.10) sanity checks. I'll buy the first person to[](#l3.11)