Message 75535 - Python tracker
As far as I know, the above code will fail randomly in release mode if you have multiple threads running Python, because when ctypes calls out to CFUNCTYPE functions, it releases the GIL. For decorating a python function to give to qsort, maybe you can use PYFUNCTYPE?