[pypy-dev] Segfault observed while loading dynamic library in (pypy-7.0.0-linux_x86_64-portable)

Nabil Memon nabilmemon.ec at gmail.com
Thu Jul 25 10:53:32 EDT 2019


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.rigo at gmail.com> wrote:

> Hi Nabil,
>
> On Wed, 24 Jul 2019 at 09:02, Nabil Memon <nabilmemon.ec at 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20190725/d5a2fb85/attachment.html>


More information about the pypy-dev mailing list