[Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface
Friedrich Romstedt
friedrichromstedt at gmail.com
Thu Feb 4 03:07:59 EST 2021
Hello Matti,
Am Mo., 1. Feb. 2021 um 09:46 Uhr schrieb Matti Picus <matti.picus at gmail.com>:
>
> [...]
>
> It is very hard to help you from this description. It may be a refcount
> problem, it may be a buffer protocol problem, it may be something else.
Yes, indeed!
> Typically, one would create a complete example and then pointing to the
> code (as repo or pastebin, not as an attachment to a mail here).
https://github.com/friedrichromstedt/bughunting-01
I boiled it down considerably, compared to the program where I
stumbled upon the problem. In the abovementioned repo, you find a
Python test script in the `test/` folder. Therein, a single `print`
statement can be used to trigger or to avoid the error. On Linux, I
get a somewhat more precise description than just from the premature
exit on Windows: It is a segfault.
Certainly it is still asked quite much to skim through my source code,
however, I hope that I trimmed it down sufficiently.
> - Make sure you give instructions how to build your project for Linux,
> since most of the people on this list do not use windows.
The code reproducing the segfault can be compiled by `$ python3
setup.py install`, both on Windows as well as on Linux.
> - There are tools out there to analyze refcount problems. Python has
> some built-in tools for switching allocation strategies.
Can you give me some pointer about this?
> - numpy.asarray has a number of strategies to convert instances, which
> one is it using?
I've tried to read about this, but coudn't find anything. What are
these different strategies?
Many thanks in advance,
Friedrich
More information about the NumPy-Discussion
mailing list