[pypy-svn] r9938 - pypy/dist/pypy/objspace/std

alex at codespeak.net alex at codespeak.net
Sun Mar 20 18:18:36 CET 2005


Author: alex
Date: Sun Mar 20 18:18:35 2005
New Revision: 9938

Modified:
   pypy/dist/pypy/objspace/std/objecttype.py
Log:
implemented override of __reduce_ex__ by __reduce__



Modified: pypy/dist/pypy/objspace/std/objecttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objecttype.py	(original)
+++ pypy/dist/pypy/objspace/std/objecttype.py	Sun Mar 20 18:18:35 2005
@@ -47,10 +47,13 @@
     except OperationError: pass
     else:
         w_cls = space.getattr(w_obj, space.wrap('__class__'))
-        w_cls_reduce = space.getattr(w_cls, w_st_reduce)
+        w_cls_reduce_meth = space.getattr(w_cls, w_st_reduce)
+        w_cls_reduce = space.getattr(w_cls_reduce_meth, space.wrap('im_func'))
         w_objtype = space.w_object
-        w_obj_reduce = space.getattr(w_objtype, space.wrap('__dict__'))
+        w_obj_dict = space.getattr(w_objtype, space.wrap('__dict__'))
+        w_obj_reduce = space.getitem(w_obj_dict, w_st_reduce)
         override = space.is_true(space.ne(w_cls_reduce, w_obj_reduce))
+        # print 'OVR', override, w_cls_reduce, w_obj_reduce
         if override:
             return space.call(w_reduce, space.newtuple([]))
     if proto >= 2:



More information about the Pypy-commit mailing list