Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"
error handler on 64-bit platforms. Patch by Yogesh Chaudhari.
diff --git a/Misc/ACKS b/Misc/ACKS
index 52019a8..8aba36e 100644
--- 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
index 0f4b701..9ee4cfe 100644
--- 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
index cd6d443..6802758 100644
--- 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
index 91147a0..69498c4 100644
--- 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;