Author: Richard Plangger <planri...@gmail.com> Branch: py3.5 Changeset: r90413:411407ffbeac Date: 2017-02-27 18:55 +0100 http://bitbucket.org/pypy/pypy/changeset/411407ffbeac/
Log: (ronan, plan_rich) fix descriptor invocation inside the descr_call of W_TypeObject diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py --- a/pypy/objspace/std/typeobject.py +++ b/pypy/objspace/std/typeobject.py @@ -631,7 +631,7 @@ if w_newdescr is None: # see test_crash_mro_without_object_1 raise oefmt(space.w_TypeError, "cannot create '%N' instances", self) - w_newfunc = space.get(w_newdescr, self) + w_newfunc = space.get(w_newdescr, space.w_None, w_type=self) if (space.config.objspace.std.newshortcut and not we_are_jitted() and isinstance(w_newtype, W_TypeObject)): diff --git a/pypy/objspace/test/test_descriptor.py b/pypy/objspace/test/test_descriptor.py --- a/pypy/objspace/test/test_descriptor.py +++ b/pypy/objspace/test/test_descriptor.py @@ -152,3 +152,13 @@ assert hash(myfloat(-1.0)) == -2 assert hash(myHashClass()) == -2 assert hash(myHashClass3()) == hash(-10**100) + + def test_descr_funny_new(self): + class C(object): + @classmethod + def __new__(*args): + return args + + assert C.__new__(1,2) == (C, 1, 2) + assert C(1,2) == (C, C, 1, 2) + _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit