[Numpy-discussion] Unreliable crash when converting using numpy.asarray via C buffer interface

Friedrich Romstedt friedrichromstedt at gmail.com
Mon Feb 1 02:57:40 EST 2021


Hi,

Am Di., 26. Jan. 2021 um 09:48 Uhr schrieb Friedrich Romstedt
<friedrichromstedt at gmail.com>:
>
> [...] The following Python
> code crashes::
>
>     image = <... Image production ...>
>     ar = numpy.asarray(image)
>
> However, when I say::
>
>     image = <... Image production ...>
>     print("---")
>     ar = numpy.asarray(image)
>
> the entire program is executing properly with correct data in the
> numpy ndarray produced using the buffer interface.
>
> [...]

Does anyone have an idea about this?  By the way, I noticed that this
mailing list turned pretty quiet, am I missing something?

For completeness, the abovementioned "crash" shows up as just a
premature exit of the program.  There is no error message whatsoever.
The buffer view producing function raises Exceptions properly when
something goes wrong; also notice that this code completes without
error when the ``print("---")`` statement is in action.  So I presume
the culprit lies somewhere on the C level.  I can only guess that it
might be some side-effect unknown to me.

Best,
Friedrich


More information about the NumPy-Discussion mailing list