diff options
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r-- | Objects/intobject.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c index 63034bcac0..2062bee9de 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -255,18 +255,18 @@ PyInt_AsUnsignedLongMask(register PyObject *op) if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || nb->nb_int == NULL) { PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; + return (unsigned long)-1; } io = (PyIntObject*) (*nb->nb_int) (op); if (io == NULL) - return -1; + return (unsigned long)-1; if (!PyInt_Check(io)) { if (PyLong_Check(io)) { val = PyLong_AsUnsignedLongMask((PyObject *)io); Py_DECREF(io); if (PyErr_Occurred()) - return -1; + return (unsigned long)-1; return val; } else @@ -274,7 +274,7 @@ PyInt_AsUnsignedLongMask(register PyObject *op) Py_DECREF(io); PyErr_SetString(PyExc_TypeError, "nb_int should return int object"); - return -1; + return (unsigned long)-1; } } @@ -300,18 +300,18 @@ PyInt_AsUnsignedLongLongMask(register PyObject *op) if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || nb->nb_int == NULL) { PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; + return (unsigned PY_LONG_LONG)-1; } io = (PyIntObject*) (*nb->nb_int) (op); if (io == NULL) - return -1; + return (unsigned PY_LONG_LONG)-1; if (!PyInt_Check(io)) { if (PyLong_Check(io)) { val = PyLong_AsUnsignedLongLongMask((PyObject *)io); Py_DECREF(io); if (PyErr_Occurred()) - return -1; + return (unsigned PY_LONG_LONG)-1; return val; } else @@ -319,7 +319,7 @@ PyInt_AsUnsignedLongLongMask(register PyObject *op) Py_DECREF(io); PyErr_SetString(PyExc_TypeError, "nb_int should return int object"); - return -1; + return (unsigned PY_LONG_LONG)-1; } } @@ -1152,6 +1152,7 @@ PyInt_Fini(void) PyIntObject *p; PyIntBlock *list, *next; int i; + unsigned int ctr; int bc, bf; /* block count, number of freed blocks */ int irem, isum; /* remaining unfreed ints per block, total */ @@ -1174,9 +1175,9 @@ PyInt_Fini(void) while (list != NULL) { bc++; irem = 0; - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { + for (ctr = 0, p = &list->objects[0]; + ctr < N_INTOBJECTS; + ctr++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) irem++; } @@ -1184,9 +1185,9 @@ PyInt_Fini(void) if (irem) { list->next = block_list; block_list = list; - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { + for (ctr = 0, p = &list->objects[0]; + ctr < N_INTOBJECTS; + ctr++, p++) { if (!PyInt_CheckExact(p) || p->ob_refcnt == 0) { p->ob_type = (struct _typeobject *) @@ -1227,9 +1228,9 @@ PyInt_Fini(void) if (Py_VerboseFlag > 1) { list = block_list; while (list != NULL) { - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { + for (ctr = 0, p = &list->objects[0]; + ctr < N_INTOBJECTS; + ctr++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) /* XXX(twouters) cast refcount to long until %zd is universally |