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 | 1c873bf77d855e821d7c1b4d9a2489b2a1b85f5f (patch) | |
tree | 9b334f8dbb6480d9d2149d7fe1d6dddf2a045a69 /Lib | |
parent | f8c4b3a730461c10766f66784c268ce0d923ad39 (diff) | |
download | cpython-1c873bf77d855e821d7c1b4d9a2489b2a1b85f5f.zip cpython-1c873bf77d855e821d7c1b4d9a2489b2a1b85f5f.tar.gz cpython-1c873bf77d855e821d7c1b4d9a2489b2a1b85f5f.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 af3b90a..2a3b4a3 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1474,6 +1474,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 |