[pypy-svn] r34644 - pypy/dist/pypy/lib

fijal at codespeak.net fijal at codespeak.net
Wed Nov 15 22:34:25 CET 2006


Author: fijal
Date: Wed Nov 15 22:34:24 2006
New Revision: 34644

Modified:
   pypy/dist/pypy/lib/distributed.py
Log:
A small heuristic to copy __doc__ as well.


Modified: pypy/dist/pypy/lib/distributed.py
==============================================================================
--- pypy/dist/pypy/lib/distributed.py	(original)
+++ pypy/dist/pypy/lib/distributed.py	Wed Nov 15 22:34:24 2006
@@ -259,8 +259,7 @@
         # XXX: We don't support inheritance here, nor recursive types
         #      shall we???
         _dict = dict([(key, self.wrap(getattr(tp, key))) for key in dir(tp) 
-            if key not in ('__dict__', '__weakref__', '__class__', '__new__',
-                '__doc__')])
+            if key not in ('__dict__', '__weakref__', '__class__', '__new__')])
         self.send(("type_reg", (tp_id, 
             tp.__name__, _dict)))
         return tp_id
@@ -275,10 +274,13 @@
         print "Faking type %s as %s" % (_name, type_id)
         # create and register new type
         d = dict([(key, None) for key in _dict])
+        if '__doc__' in _dict:
+            d['__doc__'] = self.unwrap(_dict['__doc__'])
         tp = type(_name, (object,), d)
         self.remote_types[type_id] = tp
         for key, value in _dict.items():
-            setattr(tp, key, self.unwrap(value))
+            if key != '__doc__':
+                setattr(tp, key, self.unwrap(value))
     
     def get_type(self, id):
         try:



More information about the Pypy-commit mailing list