Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d7e775

Browse files
committed
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.
1 parent 1b1fe97 commit 7d7e775

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/_io/textio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ typedef struct {
224224
PyObject_HEAD
225225
PyObject *decoder;
226226
PyObject *errors;
227-
signed int pendingcr: 1;
228-
signed int translate: 1;
227+
unsigned int pendingcr: 1;
228+
unsigned int translate: 1;
229229
unsigned int seennl: 3;
230230
} nldecoder_object;
231231

@@ -546,7 +546,7 @@ incrementalnewlinedecoder_setstate(nldecoder_object *self, PyObject *state)
546546
if (!PyArg_Parse(state, "(OK)", &buffer, &flag))
547547
return NULL;
548548

549-
self->pendingcr = (int) flag & 1;
549+
self->pendingcr = (int) (flag & 1);
550550
flag >>= 1;
551551

552552
if (self->decoder != Py_None)

0 commit comments

Comments
 (0)