[Numpy-discussion] py2/py3 pickling
Pauli Virtanen
pav at iki.fi
Tue Aug 25 12:12:30 EDT 2015
25.08.2015, 01:15, Chris Laumann kirjoitti:
> Would it be possible then (in relatively short order) to create
> a py2 -> py3 numpy pickle converter?
You probably need to modify the pickle stream directly, replacing
*STRING opcodes with *BYTES opcodes when it comes to objects that are
needed for constructing Numpy arrays.
https://hg.python.org/cpython/file/tip/Modules/_pickle.c#l82
Or, use a custom pickler class that emits the new opcodes when it comes
to data that is part of Numpy arrays, as Python 2 pickler doesn't know
how to write bytes opcodes.
It's probably doable, although likely annoying to implement. the pickles
created won't be loadable on Py2, only Py3.
You'd need to find a volunteer who wants to work on this or just do it
yourself, though.
More information about the NumPy-Discussion
mailing list