[pypy-svn] r27065 - in pypy/dist/pypy: interpreter module/_pickle_support objspace/std
ericvrp at codespeak.net
ericvrp at codespeak.net
Thu May 11 09:56:09 CEST 2006
Author: ericvrp
Date: Thu May 11 09:56:07 2006
New Revision: 27065
Modified:
pypy/dist/pypy/interpreter/pycode.py
pypy/dist/pypy/module/_pickle_support/__init__.py
pypy/dist/pypy/module/_pickle_support/maker.py
pypy/dist/pypy/objspace/std/dicttype.py
Log:
Still struggling with pickling dictiterator. (still disabled)
Modified: pypy/dist/pypy/interpreter/pycode.py
==============================================================================
--- pypy/dist/pypy/interpreter/pycode.py (original)
+++ pypy/dist/pypy/interpreter/pycode.py Thu May 11 09:56:07 2006
@@ -10,7 +10,6 @@
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import NoneNotWrapped
from pypy.interpreter.baseobjspace import ObjSpace, W_Root
-from pypy.interpreter.mixedmodule import MixedModule
from pypy.rpython.rarithmetic import intmask
# helper
@@ -401,6 +400,7 @@
descr_code__new__.unwrap_spec = unwrap_spec
def descr__reduce__(self, space):
+ from pypy.interpreter.mixedmodule import MixedModule
w_mod = space.getbuiltinmodule('_pickle_support')
mod = space.interp_w(MixedModule, w_mod)
new_inst = mod.get('code_new')
Modified: pypy/dist/pypy/module/_pickle_support/__init__.py
==============================================================================
--- pypy/dist/pypy/module/_pickle_support/__init__.py (original)
+++ pypy/dist/pypy/module/_pickle_support/__init__.py Thu May 11 09:56:07 2006
@@ -7,9 +7,11 @@
}
interpleveldefs = {
- 'cell_new' : 'maker.cell_new',
- 'code_new' : 'maker.code_new',
- 'func_new' : 'maker.func_new',
- 'module_new' : 'maker.module_new',
- 'method_new' : 'maker.method_new',
+ 'cell_new' : 'maker.cell_new',
+ 'code_new' : 'maker.code_new',
+ 'func_new' : 'maker.func_new',
+ 'module_new' : 'maker.module_new',
+ 'method_new' : 'maker.method_new',
+ 'dictiter_new' : 'maker.dictiter_new',
+ 'seqiter_new' : 'maker.seqiter_new',
}
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 Thu May 11 09:56:07 2006
@@ -5,6 +5,8 @@
from pypy.rpython.objectmodel import instantiate
from pypy.interpreter.argument import Arguments
from pypy.interpreter.baseobjspace import ObjSpace, W_Root
+from pypy.objspace.std.dicttype import dictiter_typedef
+from pypy.objspace.std.itertype import iter_typedef as seqiter_typedef
#note: for now we don't use the actual value when creating the Cell.
@@ -32,3 +34,30 @@
w_type = space.gettypeobject(Method.typedef)
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__):
+ print "dictiter_new here 1)", space, w_dictitertype
+ #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
+ from pypy.objspace.std.dictobject import 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]
+
+#XXX this doesn't work either
+def seqiter_new(space, w_seqitertype, __args__):
+ raise 'No seqiter_new (pickle support) yet'
+ print "seqiter_new here 1)", space, __args__
+ w_type = space.gettypeobject(seqiter_typedef)
+ print "seqiter_new here 2)", w_type
+ a = space.call_args(w_type, __args__)
+ print "seqiter_new here 3)", a
+ return a
+seqiter_new.unwrap_spec = [ObjSpace, W_Root, Arguments]
Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py (original)
+++ pypy/dist/pypy/objspace/std/dicttype.py Thu May 11 09:56:07 2006
@@ -122,6 +122,38 @@
)
dict_typedef.registermethods(globals())
+# ____________________________________________________________
+
+def descr_dictiter__reduce__(space, w_subtype):
+ from pypy.interpreter.mixedmodule import MixedModule
+ w_mod = space.getbuiltinmodule('_pickle_support')
+ mod = space.interp_w(MixedModule, w_mod)
+ new_inst = mod.get('dictiter_new')
+ w = space.wrap
+ tup = [
+ #w(10),
+ #w(self.co_argcount),
+ #w(self.co_nlocals),
+ #w(self.co_stacksize),
+ #w(self.co_flags),
+ #w(self.co_code),
+ #space.newtuple(self.co_consts_w),
+ #space.newtuple(self.co_names_w),
+ #space.newtuple([w(v) for v in self.co_varnames]),
+ #w(self.co_filename),
+ #w(self.co_name),
+ #w(self.co_firstlineno),
+ #w(self.co_lnotab),
+ #space.newtuple([w(v) for v in self.co_freevars]),
+ #space.newtuple([w(v) for v in self.co_cellvars]),
+ #hidden_applevel=False, magic = 62061 | 0x0a0d0000
+ ]
+ return space.newtuple([new_inst, space.newtuple(tup)])
+
+# ____________________________________________________________
dictiter_typedef = StdTypeDef("dictionaryiterator",
+ __reduce__ = gateway.interp2app(descr_dictiter__reduce__,
+ unwrap_spec=[gateway.ObjSpace,gateway.W_Root]),
)
+#note: registering in dictobject.py
More information about the Pypy-commit
mailing list