Extracting pickle from Python

P

Philippe C. Martin

Hi,

How would one go about extracting the pickle module from Python (ex: to make
a .a or a .dll) ?

Thanks

Philippe
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Philippe said:
How would one go about extracting the pickle module from Python (ex: to make
a .a or a .dll) ?

Pickle relies heavily on Python, so you most likely have to take the
rest of Python as well when trying to integrate pickle elsewhere?

Are you looking for pickle or cPickle? pickle.py is written in Python,
so you need a full Python interpreter to run it. cPickle is written
in C, so you could go away with less than a full interpreter, but
it still calls a lot of Python interpreter functions.

To integrate a Python interpreter, see the "Embedding and Extending"
manual, in particular the "embedding" part. Essentially, you need to
link with pythonxy.dll/libpythonxy.a.

If you want a Python-free implementation of pickle, you best rewrite
it yourself. The core of pickle is fairly easy. The tricky part is
the extensibility: During unpickling, arbitrary Python functions can
be invoked to reconstruct objects, and arbitrary classes can be
instantiated, so you need to emulate constructors for all types
that may be present in your pickle files.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,200
Members
47,838
Latest member
elibuskamoSeAve

Latest Threads

Top