[pypy-commit] pypy fix-tpname: adjust getname to work like cpython

bdkearns noreply at buildbot.pypy.org
Fri May 2 03:19:31 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: fix-tpname
Changeset: r71172:5628f63f92cd
Date: 2014-05-01 20:58 -0400
http://bitbucket.org/pypy/pypy/changeset/5628f63f92cd/

Log:	adjust getname to work like cpython

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
@@ -495,11 +495,15 @@
                     return '%s.%s' % (mod, w_self.name)
         return w_self.name
 
-    def getname(w_self, space):
-        name = w_self.name
-        if name is None:
-            name = '?'
-        return name
+    def getname(self, space):
+        if self.is_heaptype():
+            return self.name
+        else:
+            dot = self.name.find('.')
+            if dot != -1:
+                return self.name[dot+1:]
+            else:
+                return self.name
 
     def add_subclass(w_self, w_subclass):
         space = w_self.space


More information about the pypy-commit mailing list