[Numpy-discussion] Should ndarray be a context manager?

Sturla Molden sturla.molden at gmail.com
Wed Dec 10 23:40:27 EST 2014


Chris Barker <chris.barker at noaa.gov> wrote:

> I haven't managed to trigger a segfault yet but it sure looks like I
> could...

You can also trigger random errors. If the array is small, Python's memory
mamager might keep the memory in the heap for reuse by PyMem_Malloc. And
then you can actually modify some random Python object with bogus bits. It
can screw things up even if you do not see a segfault.

Sturla




More information about the NumPy-Discussion mailing list