diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-09-30 02:46:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-09-30 02:46:57 (GMT) |
commit | bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6 (patch) | |
tree | c2acd0daf41ca6a3c27eae19a6a50515d2d1a37c /Lib | |
parent | d48bc9468f75e57249da5e3518c42d4c8b83ba29 (diff) | |
download | cpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.zip cpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.tar.gz cpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.tar.bz2 |
clear BufferedRWPair weakrefs on deallocation (closes #22517)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_io.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 2a96b7b..4b49d33 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1524,6 +1524,12 @@ class BufferedRWPairTest(unittest.TestCase): pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(True)) self.assertTrue(pair.isatty()) + def test_weakref_clearing(self): + brw = self.tp(self.MockRawIO(), self.MockRawIO()) + ref = weakref.ref(brw) + brw = None + ref = None # Shouldn't segfault. + class CBufferedRWPairTest(BufferedRWPairTest): tp = io.BufferedRWPair |