Canberk Sönmez added the comment:
Alright, I solved the problem. It was simply a typo: "restypes" instead of
"res_types". It didn't cause a problem in Python 3.6 but obviously, something
was changed. A nice error message might be nice when setting these attribute
New submission from Canberk Sönmez :
Please see the SO post:
https://stackoverflow.com/questions/66713071/ctypes-heap-pointer-is-damaged-between-c-and-python-linux-x86-64
In summary, when I return a pointer to a heap-allocated memory location from a
C function, its most significant 32 bits