[Python-checkins] cpython (2.7): Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"

serhiy.storchaka python-checkins at python.org
Tue Aug 20 19:12:03 CEST 2013


http://hg.python.org/cpython/rev/5e679ef2a55c
changeset:   85280:5e679ef2a55c
branch:      2.7
parent:      85276:7b867a46a8b4
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Aug 20 20:08:53 2013 +0300
summary:
  Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"
error handler on 64-bit platforms.  Patch by Yogesh Chaudhari.

files:
  Misc/ACKS            |  1 +
  Misc/NEWS            |  6 ++++++
  Modules/_io/textio.c |  2 +-
  Python/codecs.c      |  2 +-
  4 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -170,6 +170,7 @@
 Mitch Chapman
 Greg Chapman
 Brad Chapman
+Yogesh Chaudhari
 David Chaum
 Nicolas Chauvat
 Michael Chermside
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,9 @@
 Core and Builtins
 -----------------
 
+- Issue #13461: Fix a crash in the "replace" error handler on 64-bit platforms.
+  Patch by Yogesh Chaudhari.
+
 - Issue #15866: The xmlcharrefreplace error handler no more produces two XML
   entities for a non-BMP character on narrow build.
 
@@ -29,6 +32,9 @@
 Library
 -------
 
+- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit
+  platforms.  Patch by Yogesh Chaudhari.
+
 - Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
   OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
 
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2271,7 +2271,7 @@
         int dec_flags;
 
         PyObject *decoded = PyObject_CallMethod(
-            self->decoder, "decode", "s#", input, 1);
+            self->decoder, "decode", "s#", input, (Py_ssize_t)1);
         if (check_decoded(decoded) < 0)
             goto fail;
         chars_decoded += PyUnicode_GET_SIZE(decoded);
diff --git a/Python/codecs.c b/Python/codecs.c
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -521,7 +521,7 @@
         Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER;
         if (PyUnicodeDecodeError_GetEnd(exc, &end))
             return NULL;
-        return Py_BuildValue("(u#n)", &res, 1, end);
+        return Py_BuildValue("(u#n)", &res, (Py_ssize_t)1, end);
     }
     else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) {
         PyObject *res;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list