STINNER Victor added the comment:
The issue looks like a bug in third party code, rather than a bug in Python
itself. You can try to set PYTHONMALLOC=debug environment variable, it might
help to detect a memory corruption. I strongly advice you to test a debug build
of Python. Since Python 3
New submission from Jeremy :
If a unittest is written which accesses a module written in C++ (I used
Pybind11 to allow Python access) which uses malloc for a string, a segmentation
fault is caused. This is not replicated when malloc is used for some other data
types such as int, char or char*