}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(v)) {
- if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) {
+ if (PyUnicode_GET_SIZE(v) >= (Py_ssize_t)sizeof(s_buffer)) {
PyErr_SetString(PyExc_ValueError,
"complex() literal too large to convert");
return NULL;
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(v)) {
- if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) {
+ if (PyUnicode_GET_SIZE(v) >= (Py_ssize_t)sizeof(s_buffer)) {
PyErr_SetString(PyExc_ValueError,
"Unicode float() literal too long to convert");
return NULL;
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
Py_DECREF(io);
PyErr_SetString(PyExc_TypeError,
"nb_int should return int object");
- return -1;
+ return (unsigned long)-1;
}
}
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
Py_DECREF(io);
PyErr_SetString(PyExc_TypeError,
"nb_int should return int object");
- return -1;
+ return (unsigned PY_LONG_LONG)-1;
}
}
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 */
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++;
}
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 *)
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
digit msd = v->ob_digit[ndigits - 1];
result = (ndigits - 1) * SHIFT;
- if (result / SHIFT != ndigits - 1)
+ if (result / SHIFT != (size_t)(ndigits - 1))
goto Overflow;
do {
++result;
if (vv == NULL || !PyLong_Check(vv)) {
PyErr_BadInternalCall();
- return -1;
+ return (unsigned PY_LONG_LONG)-1;
}
res = _PyLong_AsByteArray(
*s = PyString_AS_STRING(obj);
if (len != NULL)
*len = PyString_GET_SIZE(obj);
- else if (strlen(*s) != PyString_GET_SIZE(obj)) {
+ else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) {
PyErr_SetString(PyExc_TypeError,
"expected string without null bytes");
return -1;
off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \
consistent method resolution\norder (MRO) for bases");
i = 0;
- while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) {
+ while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) {
PyObject *name = class_name(k);
off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s",
name ? PyString_AS_STRING(name) : "?");
Py_XDECREF(name);
- if (--n && off+1 < sizeof(buf)) {
+ if (--n && (size_t)(off+1) < sizeof(buf)) {
buf[off++] = ',';
buf[off] = '\0';
}
/* Note: this depends on the order of the members of PyHeapTypeObject! */
assert(offset >= 0);
- assert(offset < offsetof(PyHeapTypeObject, as_buffer));
- if (offset >= offsetof(PyHeapTypeObject, as_sequence)) {
+ assert((size_t)offset < offsetof(PyHeapTypeObject, as_buffer));
+ if ((size_t)offset >= offsetof(PyHeapTypeObject, as_sequence)) {
ptr = (char *)type->tp_as_sequence;
offset -= offsetof(PyHeapTypeObject, as_sequence);
}
- else if (offset >= offsetof(PyHeapTypeObject, as_mapping)) {
+ else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_mapping)) {
ptr = (char *)type->tp_as_mapping;
offset -= offsetof(PyHeapTypeObject, as_mapping);
}
- else if (offset >= offsetof(PyHeapTypeObject, as_number)) {
+ else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_number)) {
ptr = (char *)type->tp_as_number;
offset -= offsetof(PyHeapTypeObject, as_number);
}