summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-11-12 15:19:46 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-11-12 15:19:46 (GMT)
commit6c14f231005a2a3a63bd4b0157c908e94bd834ac (patch)
tree8d1e7e34b0f8b26dd89272091636bd34dce0104d /Lib/test/test_io.py
parentdfede95a069d418c91a26d5999958b525172e687 (diff)
downloadcpython-6c14f231005a2a3a63bd4b0157c908e94bd834ac.zip
cpython-6c14f231005a2a3a63bd4b0157c908e94bd834ac.tar.gz
cpython-6c14f231005a2a3a63bd4b0157c908e94bd834ac.tar.bz2
fix possible double free in TextIOWrapper.__init__ (closes #22849)
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index b5506b0..940e921 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2784,6 +2784,21 @@ class TextIOWrapperTest(unittest.TestCase):
self.assertFalse(err)
self.assertEqual("ok", out.decode().strip())
+ def test_issue22849(self):
+ class F(object):
+ def readable(self): return True
+ def writable(self): return True
+ def seekable(self): return True
+
+ for i in range(10):
+ try:
+ self.TextIOWrapper(F(), encoding='utf-8')
+ except Exception:
+ pass
+
+ F.tell = lambda x: 0
+ t = self.TextIOWrapper(F(), encoding='utf-8')
+
class CTextIOWrapperTest(TextIOWrapperTest):
io = io