I did figure out the workaround by not importing this cpyext module at first.
I didn't dig deep into the CPP module, thanks a lot for pointing out the exact gray area. You saved me a lot of time. Au revoir. Regards, Nabil On Thu, 25 Jul, 2019, 7:52 PM Armin Rigo, <armin.r...@gmail.com> wrote: > Hi Nabil, > > On Wed, 24 Jul 2019 at 09:02, Nabil Memon <nabilmemon...@gmail.com> wrote: > >> I am currently using pypy(pypy-7.0.0-linux_x86_64-portable) and I am > facing some issues using it. > >> I installed pip, cython and numpy using commands: > >> $ ./pypy-xxx/bin/pypy -m ensurepip > >> $ ./pypy-xxx/bin/pip install cython numpy > >> After that, I installed one package "pysubnettree" thorough pypy's pip. > >> While importing SubnetTree class, I get segmentation fault. > > This is because the module does something that is unexpected from us, > and probably in the gray area of "correctness". The C++ module > SubnetTree.cc contains this global variable declaration (it couldn't > occur in C): > > static PyObject* dummy = Py_BuildValue("s", "<dummy string>"); > > This is in the gray area because there is no particular guarantee > that, even on CPython, this is called while the GIL is held. In the > case of PyPy, that crashes if it's the first cpyext module you import. > A quick workaround is to say "import numpy" before; this should fix > that particular problem. > > We may figure out an acceptable workaround, but this is really a > "don't do that". Ideally you should fix it in SubnetTree.cc and > submit a pull request. > > > A bientôt, > > Armin. >
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev