Message377674
You are correct.
After further review, I found an older ctypes issue #12836 which was then enshrined in a workaround in the numpy.ndarray.ctypes interface to vanilla ctypes.
https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html
Numpy ctypes has both a `data` method for which "a reference will not be kept to the array" and a `data_as` method which has the desired behavior: "The returned pointer will keep a reference to the array."
So, we've all got our workarounds. What remains is whether/how to implement a check in Python for the dangling pointer. I have no advice on that, except that it is desirable to avoid the fault crash, no matter who is to blame. |
|
Date |
User |
Action |
Args |
2020-09-29 16:45:37 | NankerPhelge | set | recipients:
+ NankerPhelge, eryksun |
2020-09-29 16:45:37 | NankerPhelge | set | messageid: <1601397937.62.0.39072354581.issue41883@roundup.psfhosted.org> |
2020-09-29 16:45:37 | NankerPhelge | link | issue41883 messages |
2020-09-29 16:45:37 | NankerPhelge | create | |
|