[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (closes #22643)

benjamin.peterson python-checkins at python.org
Wed Oct 15 18:18:01 CEST 2014


https://hg.python.org/cpython/rev/8195d48a5c43
changeset:   93076:8195d48a5c43
parent:      93073:d0f8f242531b
parent:      93075:2a25076c50ad
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Oct 15 12:17:47 2014 -0400
summary:
  merge 3.4 (closes #22643)

files:
  Objects/unicodeobject.c |  5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9675,12 +9675,11 @@
     kind = PyUnicode_KIND(self);
     data = PyUnicode_DATA(self);
     length = PyUnicode_GET_LENGTH(self);
-    if (length > PY_SSIZE_T_MAX / 3 ||
-        length > PY_SIZE_MAX / (3 * sizeof(Py_UCS4))) {
+    if (length > PY_SSIZE_T_MAX / (3 * sizeof(Py_UCS4))) {
         PyErr_SetString(PyExc_OverflowError, "string is too long");
         return NULL;
     }
-    tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * (size_t)length);
+    tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
     if (tmp == NULL)
         return PyErr_NoMemory();
     newlength = perform(kind, data, length, tmp, &maxchar);

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


More information about the Python-checkins mailing list