[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (#22849)
benjamin.peterson
python-checkins at python.org
Wed Nov 12 16:24:31 CET 2014
https://hg.python.org/cpython/rev/a664b150b6c2
changeset: 93479:a664b150b6c2
parent: 93477:fb3061ba6fd2
parent: 93478:ec1948191461
user: Benjamin Peterson <benjamin at python.org>
date: Wed Nov 12 10:23:35 2014 -0500
summary:
merge 3.4 (#22849)
files:
Lib/test/test_io.py | 16 ++++++++++++++++
Misc/NEWS | 2 ++
Modules/_io/textio.c | 2 +-
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2856,6 +2856,22 @@
self.assertEqual(t.read(200), bytes_val.decode('utf-8'))
+ 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 MemviewBytesIO(io.BytesIO):
'''A BytesIO object whose read method returns memoryviews
rather than bytes'''
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -188,6 +188,8 @@
- Issue #22578: Added attributes to the re.error class.
+- Issue #22849: Fix possible double free in the io.TextIOWrapper constructor.
+
- Issue #12728: Different Unicode characters having the same uppercase but
different lowercase are now matched in case-insensitive regular expressions.
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1061,7 +1061,7 @@
}
/* Finished sorting out the codec details */
- Py_DECREF(codec_info);
+ Py_CLEAR(codec_info);
self->buffer = buffer;
Py_INCREF(buffer);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list