[pypy-dev] How to fix pypy3 runtime error ?

Matti Picus matti.picus at gmail.com
Mon Nov 29 02:04:39 EST 2021


On 29/11/21 7:38 am, Hao Wang wrote:
> Dear devs:
>
> I encountered the following error but didn't know how to fix it. 
> Please help.
>
> cpyext, the emulation layer, detected that while it is calling
> an object's tp_dealloc, the C code calls back a function that
> tries to recreate the PyPy version of the object.  Usually it
> means that tp_dealloc calls some general PyXxx() API.  It is
> a dangerous and potentially buggy thing to do: even in CPython
> the PyXxx() function could, in theory, cause a reference to the
> object to be taken and stored somewhere, for an amount of time
> exceeding tp_dealloc itself.  Afterwards, the object will be
> freed, making that reference point to garbage.
> >>> PyPy could contain some workaround to still work if
> you are lucky, but it is not done so far; better fix the bug in
> the CPython extension.
> >>> This object is of type 'pandas._libs.parsers.TextReader'
> Aborted
>
> Bravo !
> Hao Wang


You don't show any code so it is difficult to guess what is going on. In 
general, PyPy is more sensitive to closing resources after use rather 
than depending on the garbage collector to release them when an object 
is collected. You could try closing the parser before it goes out of scope.


Matti



More information about the pypy-dev mailing list