set tp_new from the class in the hierarchy that actually owns the descriptor (closes #25731)

Debugging by Eryk Sun.
This commit is contained in:
Benjamin Peterson 2016-01-18 21:11:18 -08:00
parent 9e9f850f99
commit 9ad11544bf
3 changed files with 11 additions and 1 deletions

View file

@ -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:
def __init__(self, a):
pass
X.__new__ = None
del X.__new__
X(1) # should work
class DictProxyTests(unittest.TestCase):
def setUp(self):