[Python-checkins] cpython (merge 3.5 -> default): merge 3.5

benjamin.peterson python-checkins at python.org
Tue Sep 6 23:42:29 EDT 2016


https://hg.python.org/cpython/rev/e588a0198b24
changeset:   103208:e588a0198b24
parent:      103205:26601191b368
parent:      103206:2454feeb5442
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Sep 06 20:42:17 2016 -0700
summary:
  merge 3.5

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5229,7 +5229,7 @@
        mark is skipped, in all other modes, it is copied to the output
        stream as-is (giving a ZWNBSP character). */
     if (bo == 0 && size >= 4) {
-        Py_UCS4 bom = (q[3] << 24) | (q[2] << 16) | (q[1] << 8) | q[0];
+        Py_UCS4 bom = ((unsigned int)q[3] << 24) | (q[2] << 16) | (q[1] << 8) | q[0];
         if (bom == 0x0000FEFF) {
             bo = -1;
             q += 4;
@@ -5271,7 +5271,7 @@
             Py_ssize_t pos = writer.pos;
             if (le) {
                 do {
-                    ch = (q[3] << 24) | (q[2] << 16) | (q[1] << 8) | q[0];
+                    ch = ((unsigned int)q[3] << 24) | (q[2] << 16) | (q[1] << 8) | q[0];
                     if (ch > maxch)
                         break;
                     if (kind != PyUnicode_1BYTE_KIND &&
@@ -5283,7 +5283,7 @@
             }
             else {
                 do {
-                    ch = (q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
+                    ch = ((unsigned int)q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
                     if (ch > maxch)
                         break;
                     if (kind != PyUnicode_1BYTE_KIND &&

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


More information about the Python-checkins mailing list