[Python-checkins] cpython: Issue #10310: Use "unsigned int field:1" instead of "signed int field:1" in a

victor.stinner python-checkins at python.org
Tue Jun 17 23:32:24 CEST 2014


http://hg.python.org/cpython/rev/3aeca1fd4c0e
changeset:   91252:3aeca1fd4c0e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 17 23:31:25 2014 +0200
summary:
  Issue #10310: Use "unsigned int field:1" instead of "signed int field:1" in a
private structure of the _io module to fix a compiler warning (overflow when
assigning the value 1). Fix also a cast in
incrementalnewlinedecoder_setstate().  Patch written by Hallvard B Furuseth.

files:
  Modules/_io/textio.c |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -224,8 +224,8 @@
     PyObject_HEAD
     PyObject *decoder;
     PyObject *errors;
-    signed int pendingcr: 1;
-    signed int translate: 1;
+    unsigned int pendingcr: 1;
+    unsigned int translate: 1;
     unsigned int seennl: 3;
 } nldecoder_object;
 
@@ -546,7 +546,7 @@
     if (!PyArg_Parse(state, "(OK)", &buffer, &flag))
         return NULL;
 
-    self->pendingcr = (int) flag & 1;
+    self->pendingcr = (int) (flag & 1);
     flag >>= 1;
 
     if (self->decoder != Py_None)

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


More information about the Python-checkins mailing list