diff options
author | Thomas Heller <theller@ctypes.org> | 2010-02-23 20:32:43 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2010-02-23 20:32:43 (GMT) |
commit | 41c5d2fb56b25a132015853b2612f012ca39be83 (patch) | |
tree | b582ead4677c73dcc8643c1968f02c40c15b5a00 /Lib/ctypes | |
parent | f99f67be01f23d5f59e058d7286f05b009c02c9a (diff) | |
download | cpython-41c5d2fb56b25a132015853b2612f012ca39be83.zip cpython-41c5d2fb56b25a132015853b2612f012ca39be83.tar.gz cpython-41c5d2fb56b25a132015853b2612f012ca39be83.tar.bz2 |
Merged revisions 78382 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r78382 | thomas.heller | 2010-02-23 21:25:02 +0100 (Di, 23 Feb 2010) | 11 lines
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/ctypes')
-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 1bef33f..1466f26 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.__func__(object) self.assertRaises(TypeError, prototype, lambda: None) + def test_issue_7959(self): + proto = self.functype.__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.assertEqual(len(live), 0) + try: WINFUNCTYPE except NameError: |