While implementing a patch for I found a reference leak in 'ctypes'. I couldn't find the cause immediately, but it can be reproduced by applying the attached patch and running: [meadori@motherbrain cpython]$ ./python -m test -R : test_ctypes [1/1] test_ctypes beginning 9 repetitions 123456789 ......... test_ctypes leaked [51, 51, 51, 51] references, sum=204 1 test failed: test_ctypes [174347 refs]
Ah, I see now. Thanks Benjamin. > So it's not a bug at all, right? A bug in regrtest.py maybe. 'dash_R_cleanup' clears various other caches in between test runs to avoid false positives like this. Perhaps 'ctypes._pointer_type_cache' should be cleared there as well.