Commit a9885e93 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"

error handler on 64-bit platforms.  Patch by Yogesh Chaudhari.
parent 83737c63
...@@ -170,6 +170,7 @@ Jeffrey Chang ...@@ -170,6 +170,7 @@ Jeffrey Chang
Mitch Chapman Mitch Chapman
Greg Chapman Greg Chapman
Brad Chapman Brad Chapman
Yogesh Chaudhari
David Chaum David Chaum
Nicolas Chauvat Nicolas Chauvat
Michael Chermside Michael Chermside
......
...@@ -9,6 +9,9 @@ What's New in Python 2.7.6? ...@@ -9,6 +9,9 @@ What's New in Python 2.7.6?
Core and Builtins 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 - Issue #15866: The xmlcharrefreplace error handler no more produces two XML
entities for a non-BMP character on narrow build. entities for a non-BMP character on narrow build.
...@@ -29,6 +32,9 @@ Core and Builtins ...@@ -29,6 +32,9 @@ Core and Builtins
Library 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 - 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. OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
......
...@@ -2271,7 +2271,7 @@ textiowrapper_tell(textio *self, PyObject *args) ...@@ -2271,7 +2271,7 @@ textiowrapper_tell(textio *self, PyObject *args)
int dec_flags; int dec_flags;
PyObject *decoded = PyObject_CallMethod( PyObject *decoded = PyObject_CallMethod(
self->decoder, "decode", "s#", input, 1); self->decoder, "decode", "s#", input, (Py_ssize_t)1);
if (check_decoded(decoded) < 0) if (check_decoded(decoded) < 0)
goto fail; goto fail;
chars_decoded += PyUnicode_GET_SIZE(decoded); chars_decoded += PyUnicode_GET_SIZE(decoded);
......
...@@ -521,7 +521,7 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc) ...@@ -521,7 +521,7 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER; Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER;
if (PyUnicodeDecodeError_GetEnd(exc, &end)) if (PyUnicodeDecodeError_GetEnd(exc, &end))
return NULL; 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)) { else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) {
PyObject *res; PyObject *res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment