This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author NankerPhelge
Recipients NankerPhelge, eryksun
Date 2020-09-29.16:45:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601397937.62.0.39072354581.issue41883@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-09-29 16:45:37NankerPhelgesetrecipients: + NankerPhelge, eryksun
2020-09-29 16:45:37NankerPhelgesetmessageid: <1601397937.62.0.39072354581.issue41883@roundup.psfhosted.org>
2020-09-29 16:45:37NankerPhelgelinkissue41883 messages
2020-09-29 16:45:37NankerPhelgecreate