diff options
author | Thomas Heller <theller@ctypes.org> | 2010-02-23 20:17:14 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2010-02-23 20:17:14 (GMT) |
commit | d517d0848bb6e404f8c075c3b4d56179db9554f8 (patch) | |
tree | bf9a459b0c7ce52a2cb042a3423aa5defca0e077 /Lib | |
parent | c9081b390d1192968edab7ecc39663834cef44d8 (diff) | |
download | cpython-d517d0848bb6e404f8c075c3b4d56179db9554f8.zip cpython-d517d0848bb6e404f8c075c3b4d56179db9554f8.tar.gz cpython-d517d0848bb6e404f8c075c3b4d56179db9554f8.tar.bz2 |
Merged revisions 78380 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78380 | thomas.heller | 2010-02-23 21:11:44 +0100 (Di, 23 Feb 2010) | 4 lines
ctypes CThunkObject was not registered correctly with the cycle
garbage collector, leading to possible leaks when using callback
functions.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/test/test_callbacks.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py index e3e4be8..8f8f4b2 100644 --- a/Lib/ctypes/test/test_callbacks.py +++ b/Lib/ctypes/test/test_callbacks.py @@ -118,6 +118,22 @@ class Callbacks(unittest.TestCase): prototype = self.functype.im_func(object) self.assertRaises(TypeError, prototype, lambda: None) + def test_issue_7959(self): + proto = self.functype.im_func(None) + + class X(object): + def func(self): pass + def __init__(self): + self.v = proto(self.func) + + import gc + for i in range(32): + X() + gc.collect() + live = [x for x in gc.get_objects() + if isinstance(x, X)] + self.failUnlessEqual(len(live), 0) + try: WINFUNCTYPE except NameError: |