[pypy-dev] how can i pickle an application-level object from interpreter code?

Philip Guo pg at cs.stanford.edu
Fri Oct 2 18:35:30 CEST 2009

Hi all,

I'm brand-new to PyPy, and here is my question: I want to selectively pickle
Python objects that appear in application-level code, from *within* the
interpreter.  e.g., let's say i'm using the PyPy Python interpreter to run
this program:

import foo
x = foo.ComplicatedObject()

right after the interpreter creates an instance of foo.ComplicatedObject(),
I want to serialize that instance to disk, in effect simulating this

pickle.dump(x, open('data.pickle'))

What is the easiest way for me to do this from within the interpreter code?

It seems like an instance object is represented within the interpreter as of
type "class W_InstanceObject(Wrappable)", and I can't directly pickle that
object.  If I could just call the Python standard library's pickle on 'x'
from within the interpreter, that would be great.

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20091002/840ba52a/attachment.html>

More information about the Pypy-dev mailing list