Comment 2 for bug 893461

Revision history for this message
Ryan Kelly (rfkelly) wrote :

I just hit this bug myself, and have worked up a solution for it. It's not pretty but it seems to work for me.

It's possible to work around this issue inside meliae by extending the Py_TPFLAGS_HEAPTYPE check, so that it covers both the PyType_Type.tp_traverse base case, and the StructType_Type.tp_traverse that's causing problems in this bug.

Unfortunately, you can't get a static reference to StructType_Type since it's hidden away inside the _ctypes.so shared library. So instead I added some code to look it up at runtime.

This is clearly a hack and will add extra function call overhead at runtime, so I'm not really expecting it to be merged. But maybe it will be helpful for others who get stuck on this issue.