[pypy-svn] r27481 - in pypy/dist/pypy: module/_pickle_support objspace/std
tismer at codespeak.net
tismer at codespeak.net
Fri May 19 17:12:10 CEST 2006
Author: tismer
Date: Fri May 19 17:12:09 2006
New Revision: 27481
Modified:
pypy/dist/pypy/module/_pickle_support/maker.py
pypy/dist/pypy/objspace/std/dicttype.py
Log:
showing a way to produce an unpickled object.
Note that in this special case, we need to do something
different, anyway. Please use what you find in prickelpit.c
Modified: pypy/dist/pypy/module/_pickle_support/maker.py
==============================================================================
--- pypy/dist/pypy/module/_pickle_support/maker.py (original)
+++ pypy/dist/pypy/module/_pickle_support/maker.py Fri May 19 17:12:09 2006
@@ -35,30 +35,19 @@
return space.call_args(w_type, __args__)
method_new.unwrap_spec = [ObjSpace, Arguments]
-#XXX this does not work yet
-def dictiter_new(space, w_dictitertype, __args__=None):
- raise Exception('No dictiter_new (pickle support) yet')
- print "dictiter_new here 0)", space, w_dictitertype, __args__
- print "XXX", str(dictiter_typedef)
- if False:
- w_type = space.gettypeobject(dictiter_typedef)
- print "dictiter_new here 2)", w_type
- a = space.call_args(w_type, __args__)
- print "dictiter_new here 3)", a
- return a
- else:
- from pypy.objspace.std.dictobject import W_DictIterObject
- print "dictiter_new here 1)", space, w_dictitertype, __args__
- #import pdb;pdb.set_trace()
- if space.is_true(space.issubtype(w_dictitertype, W_DictIterObject)):
- w_obj = space.allocate_instance(W_DictIterObject, w_dictitertype)
- print "dictiter_new here 2)", w_obj
- W_DictIterObject.__init__(w_obj, space)
- print "dictiter_new here 3)", w_obj
- return w_obj
-dictiter_new.unwrap_spec = [ObjSpace, W_Root, Arguments]
+def dictiter_new(space, __args__):
+ from pypy.objspace.std.dictobject import W_DictIterObject
+ print "dictiter_new here 1)", space, w_dictitertype, __args__
+ w_type = space.gettypeobject(dictiter_typedef)
+ w_obj = space.allocate_instance(W_DictIterObject, w_type)
+ print "dictiter_new here 2)", w_obj
+ # XXX W_DictIterObject.__init__(w_obj, space)
+ # this is wrong, but we need to produce something different, anyway
+ print "dictiter_new here 3)", w_obj
+ return w_obj
+dictiter_new.unwrap_spec = [ObjSpace, Arguments]
-#XXX this doesn't work either
+#XXX this doesn't work yet
def seqiter_new(space, w_seqitertype, __args__):
raise Exception('No seqiter_new (pickle support) yet')
print "seqiter_new here 1)", space, __args__
Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py (original)
+++ pypy/dist/pypy/objspace/std/dicttype.py Fri May 19 17:12:09 2006
@@ -154,6 +154,6 @@
dictiter_typedef = StdTypeDef("dictionaryiterator",
__reduce__ = gateway.interp2app(descr_dictiter__reduce__,
- unwrap_spec=[gateway.ObjSpace,gateway.W_Root]),
+ unwrap_spec=[gateway.ObjSpace, gateway.W_Root]),
)
#note: registering in dictobject.py
More information about the Pypy-commit
mailing list