Sounds reasonable. You might want to generalize it a bit by trying to import _numpypy /numpy, and setting up the replacement by whichever fails to import. Matti
On Saturday, 25 June 2016, Eli Stevens (Gmail) <wickedg...@gmail.com> wrote: > Heh, interestingly, if I add the following to the local dir and files > when trying to unpickle under cpython, it works (note that cpython to > pypy actually works out of the box, which I hadn't realized): > > $ cat _numpypy/__init__.py > from numpy.core import * > > $ cat _numpypy/multiarray.py > from numpy.core.multiarray import * > import numpy.core.multiarray as _ncm > _reconstruct = _ncm._reconstruct > > This is obviously a total hack, and not one I'm comfortable with > (since I need to use this codebase from both cpython and pypy), but it > demonstrates that it's just bookkeeping that needs to change to get > things to work. > > My first approach would be to add a wrapper around save_global here > > https://bitbucket.org/pypy/pypy/src/a0105e0d00dbd0f73d06fc704db704868a6c6ed2/lib-python/2.7/pickle.py?at=default&fileviewer=file-view-default#pickle.py-814 > that special-cases the global '_numpypy.multiarray' to instead be > 'numpy.core.multiarray'. That seem like a reasonable thing to do? > > Cheers, > Eli > >
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev