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

Hao Wang haow85 at live.com
Mon Nov 29 02:09:10 EST 2021


I think my code doesn't even get through the following snippet :

data_pd = pd.read_csv(input_file)
cols = [col_0, col_1, col_2]

res_pd = data_pd
res_pd = res_pd.drop(cols, axis=1)

I'd like to know how to close the parser (or what it means) as well.

Bravo !
Hao Wang
________________________________
From: pypy-dev <pypy-dev-bounces+haow85=live.com at python.org> on behalf of Matti Picus <matti.picus at gmail.com>
Sent: Monday, November 29, 2021 1:04 AM
To: pypy-dev at python.org <pypy-dev at python.org>
Subject: Re: [pypy-dev] How to fix pypy3 runtime error ?


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

_______________________________________________
pypy-dev mailing list
pypy-dev at python.org
https://mail.python.org/mailman/listinfo/pypy-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pypy-dev/attachments/20211129/28ed0b71/attachment.html>


More information about the pypy-dev mailing list