Author: Matti Picus <[email protected]>
Branch: 
Changeset: r92210:0087987731d8
Date: 2017-08-22 20:27 +0300
http://bitbucket.org/pypy/pypy/changeset/0087987731d8/

Log:    cextension types should have the short names and long module for
        pickling

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
@@ -536,23 +536,27 @@
         space = self.space
         if self.is_heaptype():
             return self.getdictvalue(space, '__module__')
+        elif self.is_cpytype():
+            dot = self.name.rfind('.')
         else:
             dot = self.name.find('.')
-            if dot >= 0:
-                mod = self.name[:dot]
-            else:
-                mod = "__builtin__"
-            return space.newtext(mod)
+        if dot >= 0:
+            mod = self.name[:dot]
+        else:
+            mod = "__builtin__"
+        return space.newtext(mod)
 
     def getname(self, space):
         if self.is_heaptype():
             return self.name
+        elif self.is_cpytype():
+            dot = self.name.rfind('.')
         else:
             dot = self.name.find('.')
-            if dot >= 0:
-                return self.name[dot+1:]
-            else:
-                return self.name
+        if dot >= 0:
+            return self.name[dot+1:]
+        else:
+            return self.name
 
     def add_subclass(self, w_subclass):
         space = self.space
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to