On 2/1/21 9:57 AM, Friedrich Romstedt wrote:
Hi,

Am Di., 26. Jan. 2021 um 09:48 Uhr schrieb Friedrich Romstedt
<friedrichromst...@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


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. 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). A few things you might want to check:

- Make sure you give instructions how to build your project for Linux, since most of the people on this list do not use windows.

- There are tools out there to analyze refcount problems. Python has some built-in tools for switching allocation strategies.

- numpy.asarray has a number of strategies to convert instances, which one is it using?


Matti

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to