summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-30 12:54:39 (GMT)
committerGeorg Brandl <georg@python.org>2014-09-30 12:54:39 (GMT)
commit21bf3f942be920f3b051f6af43f7c37b9aa5cff3 (patch)
treeb3d710b9166372fc1a83fa5f4af87c1a55a75b42 /Lib
parenteaca8616ab0e219ebb5cf37d495f4bf336ec0f5e (diff)
downloadcpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.zip
cpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.tar.gz
cpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.tar.bz2
Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
weakrefs.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_io.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 8ef314e..72a844f 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1454,6 +1454,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