[pypy-commit] pypy py3.5: merge heads

plan_rich pypy.commits at gmail.com
Tue Feb 28 05:40:23 EST 2017


Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5
Changeset: r90416:38f6842e3229
Date: 2017-02-28 11:39 +0100
http://bitbucket.org/pypy/pypy/changeset/38f6842e3229/

Log:	merge heads

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)
+


More information about the pypy-commit mailing list