Skip to content

Commit 929ab93

Browse files
committed
Issue python#5933: Fix some gcc -Wextra warnings. Thanks Victor Stinner for
the patch.
1 parent 2c72420 commit 929ab93

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Modules/_ctypes/cfield.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ get_ulong(PyObject *v, unsigned long *p)
372372
return -1;
373373
}
374374
x = PyInt_AsUnsignedLongMask(v);
375-
if (x == -1 && PyErr_Occurred())
375+
if (x == (unsigned long)-1 && PyErr_Occurred())
376376
return -1;
377377
*p = x;
378378
return 0;
@@ -410,7 +410,7 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
410410
return -1;
411411
}
412412
x = PyInt_AsUnsignedLongLongMask(v);
413-
if (x == -1 && PyErr_Occurred())
413+
if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())
414414
return -1;
415415
*p = x;
416416
return 0;

‎Modules/_randommodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ random_setstate(RandomObject *self, PyObject *state)
355355

356356
for (i=0; i<N ; i++) {
357357
element = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(state, i));
358-
if (element == -1 && PyErr_Occurred())
358+
if (element == (unsigned long)-1 && PyErr_Occurred())
359359
return NULL;
360360
self->state[i] = element & 0xffffffffUL; /* Make sure we get sane state */
361361
}

0 commit comments

Comments
 (0)