Author: &#321;ukasz Langa <[email protected]>
Branch: py3.6
Changeset: r95824:c35aa59e82f6
Date: 2019-02-05 14:07 +0100
http://bitbucket.org/pypy/pypy/changeset/c35aa59e82f6/

Log:    (cfbolz,ambv) Fix __qualname__ for __new__ of built-in types

diff --git a/pypy/objspace/std/test/test_typeobject.py 
b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -427,6 +427,14 @@
     def test_method_qualname(self):
         assert dict.copy.__qualname__ == 'dict.copy'
 
+    def test_staticmethod_qualname(self):
+        assert dict.__new__.__qualname__ == 'dict.__new__'
+        class A:
+            @staticmethod
+            def stat():
+                pass
+        assert A.stat.__qualname__.endswith('A.stat')
+
     def test_builtin_add(self):
         x = 5
         assert x.__add__(6) == 11
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
@@ -1560,6 +1560,8 @@
                 w_obj = dict_w[name]
                 if isinstance(w_obj, ClassMethod):
                     w_obj = w_obj.w_function
+                if isinstance(w_obj, StaticMethod):
+                    w_obj = w_obj.w_function
                 if isinstance(w_obj, FunctionWithFixedCode):
                     qualname = (w_type.getqualname(space).encode('utf-8')
                                 + '.' + name)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to