Lib/test/leakers/test_ctypes.py
raw| 1 | |
| 2 | # Taken from Lib/test/test_ctypes/test_keeprefs.py, PointerToStructure.test(). |
| 3 | |
| 4 | from ctypes import Structure, c_int, POINTER |
| 5 | import gc |
| 6 | |
| 7 | def leak_inner(): |
| 8 | class POINT(Structure): |
| 9 | _fields_ = [("x", c_int)] |
| 10 | class RECT(Structure): |
| 11 | _fields_ = [("a", POINTER(POINT))] |
| 12 | |
| 13 | def leak(): |
| 14 | leak_inner() |
| 15 | gc.collect() |