Pickling C extension types

Martin v. Löwis martin.vonloewis at hpi.uni-potsdam.de
Mon Mar 31 05:03:52 EST 2003


> Is there an example anywhere of an extension type to Python being
> pickled? I want to define an object type in C, but have it pickle-able.

Sure! The historical example is the complex type, see copy_reg.
Using copy_reg might still be the easiest way to get pickling.

As another example, see how struct stat (os.stat_result) is pickled.

Regards,
Martin






More information about the Python-list mailing list