/Lib/test/leakers/test_ctypes.py

http://unladen-swallow.googlecode.com/ · Python · 16 lines · 10 code · 4 blank · 2 comment · 0 complexity · a1bfd5faab4ee8be5de1e146c50c4c30 MD5 · raw file

  1. # Taken from Lib/ctypes/test/test_keeprefs.py, PointerToStructure.test().
  2. # When this leak is fixed, remember to remove from Misc/build.sh LEAKY_TESTS.
  3. from ctypes import Structure, c_int, POINTER
  4. import gc
  5. def leak_inner():
  6. class POINT(Structure):
  7. _fields_ = [("x", c_int)]
  8. class RECT(Structure):
  9. _fields_ = [("a", POINTER(POINT))]
  10. def leak():
  11. leak_inner()
  12. gc.collect()