Ian M. Hoffman added the comment:
I agree with you. When I wrote "desired behavior" I intended it to mean "my
selfishly desired outcome of not loading my struct with a dangling pointer."
This issue seems to have descended into workarounds that treat the symptoms;
I
Ian M. Hoffman added the comment:
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
New submission from Ian M. Hoffman :
A description of the problem, complete example code for reproducing it, and a
work-around are available on SO at the link:
https://stackoverflow.com/questions/64083376/python-memory-corruption-after-successful-return-from-a-ctypes-foreign-function
In