diff -r 2c70897e5f98 Modules/_bz2module.c --- a/Modules/_bz2module.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_bz2module.c Sat Aug 02 02:13:42 2014 +0200 @@ -188,7 +188,7 @@ compress(BZ2Compressor *c, char *data, s if (action == BZ_FINISH && bzerror == BZ_STREAM_END) break; } - if (data_size != PyBytes_GET_SIZE(result)) + if (data_size != (size_t)PyBytes_GET_SIZE(result)) if (_PyBytes_Resize(&result, data_size) < 0) goto error; return result; @@ -457,7 +457,7 @@ decompress(BZ2Decompressor *d, char *dat d->bzs.avail_out = (unsigned int)Py_MIN(buffer_left, UINT_MAX); } } - if (data_size != PyBytes_GET_SIZE(result)) + if (data_size != (size_t)PyBytes_GET_SIZE(result)) if (_PyBytes_Resize(&result, data_size) < 0) goto error; return result; diff -r 2c70897e5f98 Modules/_codecsmodule.c --- a/Modules/_codecsmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_codecsmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -699,7 +699,7 @@ unicode_internal_encode(PyObject *self, u = PyUnicode_AsUnicodeAndSize(obj, &len); if (u == NULL) return NULL; - if (len > PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) + if (len > PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(Py_UNICODE)) return PyErr_NoMemory(); size = len * sizeof(Py_UNICODE); return codec_tuple(PyBytes_FromStringAndSize((const char*)u, size), diff -r 2c70897e5f98 Modules/_csv.c --- a/Modules/_csv.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_csv.c Sat Aug 02 02:13:42 2014 +0200 @@ -290,7 +290,7 @@ dialect_check_quoting(int quoting) StyleDesc *qs; for (qs = quote_styles; qs->name; qs++) { - if (qs->style == quoting) + if ((int)qs->style == quoting) return 0; } PyErr_Format(PyExc_TypeError, "bad \"quoting\" value"); diff -r 2c70897e5f98 Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_ctypes/callproc.c Sat Aug 02 02:13:42 2014 +0200 @@ -1606,7 +1606,7 @@ resize(PyObject *self, PyObject *args) "Memory cannot be resized because this object doesn't own it"); return NULL; } - if (size <= sizeof(obj->b_value)) { + if (size <= (Py_ssize_t)sizeof(obj->b_value)) { /* internal default buffer is large enough */ obj->b_size = size; goto done; diff -r 2c70897e5f98 Modules/_elementtree.c --- a/Modules/_elementtree.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_elementtree.c Sat Aug 02 02:13:42 2014 +0200 @@ -3741,7 +3741,7 @@ PyInit__elementtree(void) if (expat_capi) { /* check that it's usable */ if (strcmp(expat_capi->magic, PyExpat_CAPI_MAGIC) != 0 || - expat_capi->size < sizeof(struct PyExpat_CAPI) || + expat_capi->size < (int)sizeof(struct PyExpat_CAPI) || expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION || expat_capi->MINOR_VERSION != XML_MINOR_VERSION || expat_capi->MICRO_VERSION != XML_MICRO_VERSION) { diff -r 2c70897e5f98 Modules/_io/bytesio.c --- a/Modules/_io/bytesio.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_io/bytesio.c Sat Aug 02 02:13:42 2014 +0200 @@ -53,7 +53,7 @@ unshare(bytesio *self, size_t preferred_ Py_ssize_t copy_size; char *new_buf; - if((! truncate) && preferred_size < self->string_size) { + if((! truncate) && preferred_size < (size_t)self->string_size) { preferred_size = self->string_size; } @@ -64,7 +64,7 @@ unshare(bytesio *self, size_t preferred_ } copy_size = self->string_size; - if (copy_size > preferred_size) { + if ((size_t)copy_size > preferred_size) { copy_size = preferred_size; } diff -r 2c70897e5f98 Modules/_io/textio.c --- a/Modules/_io/textio.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_io/textio.c Sat Aug 02 02:13:42 2014 +0200 @@ -1730,7 +1730,7 @@ Py_ssize_t else { /* Non-universal mode. */ Py_ssize_t readnl_len = PyUnicode_GET_LENGTH(readnl); - char *nl = PyUnicode_DATA(readnl); + Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl); /* Assume that readnl is an ASCII character. */ assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND); if (readnl_len == 1) { diff -r 2c70897e5f98 Modules/_lzmamodule.c --- a/Modules/_lzmamodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_lzmamodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -533,7 +533,7 @@ compress(Compressor *c, uint8_t *data, s c->lzs.avail_out = PyBytes_GET_SIZE(result) - data_size; } } - if (data_size != PyBytes_GET_SIZE(result)) + if (data_size != (size_t)PyBytes_GET_SIZE(result)) if (_PyBytes_Resize(&result, data_size) == -1) goto error; return result; @@ -931,7 +931,7 @@ decompress(Decompressor *d, uint8_t *dat d->lzs.avail_out = PyBytes_GET_SIZE(result) - data_size; } } - if (data_size != PyBytes_GET_SIZE(result)) + if (data_size != (size_t)PyBytes_GET_SIZE(result)) if (_PyBytes_Resize(&result, data_size) == -1) goto error; return result; diff -r 2c70897e5f98 Modules/_pickle.c --- a/Modules/_pickle.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_pickle.c Sat Aug 02 02:13:42 2014 +0200 @@ -428,7 +428,7 @@ Pdata_grow(Pdata *self) if (new_allocated > PY_SSIZE_T_MAX - allocated) goto nomemory; new_allocated += allocated; - if (new_allocated > (PY_SSIZE_T_MAX / sizeof(PyObject *))) + if (new_allocated > (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(PyObject *))) goto nomemory; data = PyMem_REALLOC(data, new_allocated * sizeof(PyObject *)); if (data == NULL) @@ -850,7 +850,7 @@ static int static void _write_size64(char *out, size_t value) { - int i; + size_t i; assert(sizeof(size_t) <= 8); @@ -2123,7 +2123,7 @@ write_utf8(PicklerObject *self, char *da header[1] = (unsigned char)(size & 0xff); len = 2; } - else if (size <= 0xffffffffUL) { + else if (size <= (Py_ssize_t)0xffffffff) { header[0] = BINUNICODE; header[1] = (unsigned char)(size & 0xff); header[2] = (unsigned char)((size >> 8) & 0xff); @@ -4508,7 +4508,7 @@ calc_binsize(char *bytes, int nbytes) int i; size_t x = 0; - for (i = 0; i < nbytes && i < sizeof(size_t); i++) { + for (i = 0; i < nbytes && i < (int)sizeof(size_t); i++) { x |= (size_t) s[i] << (8 * i); } diff -r 2c70897e5f98 Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_sqlite/cursor.c Sat Aug 02 02:13:42 2014 +0200 @@ -46,7 +46,7 @@ static pysqlite_StatementKind detect_sta dst = buf; *dst = 0; - while (Py_ISALPHA(*src) && dst - buf < sizeof(buf) - 2) { + while (Py_ISALPHA(*src) && (size_t)(dst - buf) < sizeof(buf) - 2) { *dst++ = Py_TOLOWER(*src++); } diff -r 2c70897e5f98 Modules/_sre.c --- a/Modules/_sre.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_sre.c Sat Aug 02 02:13:42 2014 +0200 @@ -1249,7 +1249,7 @@ pattern_repr(PatternObject *obj) if (!flag_items) return NULL; - for (i = 0; i < Py_ARRAY_LENGTH(flag_names); i++) { + for (i = 0; i < (int)Py_ARRAY_LENGTH(flag_names); i++) { if (flags & flag_names[i].value) { PyObject *item = PyUnicode_FromString(flag_names[i].name); if (!item) diff -r 2c70897e5f98 Modules/_struct.c --- a/Modules/_struct.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_struct.c Sat Aug 02 02:13:42 2014 +0200 @@ -1319,7 +1319,7 @@ prepare_s(PyStructObject *self) } /* check for overflow */ - if ((ncodes + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) { + if ((ncodes + 1) > (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(formatcode))) { PyErr_NoMemory(); return -1; } diff -r 2c70897e5f98 Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_testcapimodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -1721,7 +1721,7 @@ test_long_numbits(PyObject *self) {-0xfffffffL, 28, -1}}; int i; - for (i = 0; i < Py_ARRAY_LENGTH(testcases); ++i) { + for (i = 0; i < (int)Py_ARRAY_LENGTH(testcases); ++i) { size_t nbits; int sign; PyObject *plong; diff -r 2c70897e5f98 Modules/_tkinter.c --- a/Modules/_tkinter.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_tkinter.c Sat Aug 02 02:13:42 2014 +0200 @@ -1414,7 +1414,7 @@ varname_converter(PyObject *in, void *_o return 0; } s = PyBytes_AsString(in); - if (strlen(s) != PyBytes_Size(in)) { + if (strlen(s) != (size_t)PyBytes_Size(in)) { PyErr_SetString(PyExc_ValueError, "null byte in bytes object"); return 0; } @@ -1431,7 +1431,7 @@ varname_converter(PyObject *in, void *_o PyErr_SetString(PyExc_OverflowError, "string is too long"); return 0; } - if (strlen(s) != size) { + if (strlen(s) != (size_t)size) { PyErr_SetString(PyExc_ValueError, "null character in string"); return 0; } diff -r 2c70897e5f98 Modules/_tracemalloc.c --- a/Modules/_tracemalloc.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/_tracemalloc.c Sat Aug 02 02:13:42 2014 +0200 @@ -79,7 +79,7 @@ typedef struct { (sizeof(traceback_t) + sizeof(frame_t) * (NFRAME - 1)) #define MAX_NFRAME \ - ((INT_MAX - sizeof(traceback_t)) / sizeof(frame_t) + 1) + ((INT_MAX - (int)sizeof(traceback_t)) / (int)sizeof(frame_t) + 1) static PyObject *unknown_filename = NULL; static traceback_t tracemalloc_empty_traceback; diff -r 2c70897e5f98 Modules/arraymodule.c --- a/Modules/arraymodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/arraymodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -2000,7 +2000,7 @@ array_reconstructor(PyObject *self, PyOb */ for (descr = descriptors; descr->typecode != '\0'; descr++) { if (descr->is_integer_type && - descr->itemsize == mf_descr.size && + (size_t)descr->itemsize == mf_descr.size && descr->is_signed == mf_descr.is_signed) typecode = descr->typecode; } diff -r 2c70897e5f98 Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/clinic/binascii.c.h Sat Aug 02 02:13:42 2014 +0200 @@ -283,7 +283,7 @@ binascii_crc_hqx(PyModuleDef *module, Py &data, &crc)) goto exit; _return_value = binascii_crc_hqx_impl(module, &data, crc); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == (int)-1) && PyErr_Occurred()) goto exit; return_value = PyLong_FromLong((long)_return_value); @@ -320,7 +320,7 @@ binascii_crc32(PyModuleDef *module, PyOb &data, &crc)) goto exit; _return_value = binascii_crc32_impl(module, &data, crc); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) goto exit; return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); @@ -475,4 +475,4 @@ exit: return return_value; } -/*[clinic end generated code: output=68e2bcc6956b6213 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=1ad2d9f32bd28f70 input=a9049054013a1b77]*/ diff -r 2c70897e5f98 Modules/fcntlmodule.c --- a/Modules/fcntlmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/fcntlmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -42,7 +42,7 @@ fcntl_fcntl(PyObject *self, PyObject *ar if (PyArg_ParseTuple(args, "O&is#:fcntl", conv_descriptor, &fd, &code, &str, &len)) { - if (len > sizeof buf) { + if (len > (Py_ssize_t)sizeof buf) { PyErr_SetString(PyExc_ValueError, "fcntl string arg too long"); return NULL; diff -r 2c70897e5f98 Modules/mathmodule.c --- a/Modules/mathmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/mathmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -1010,7 +1010,7 @@ static int /* n Py_ssize_t m = *m_ptr; m += m; /* double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { + if (n < m && m < (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(double))) { double *p = *p_ptr; if (p == ps) { v = PyMem_Malloc(sizeof(double) * m); diff -r 2c70897e5f98 Modules/mmapmodule.c --- a/Modules/mmapmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/mmapmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -1176,7 +1176,7 @@ new_mmap_object(PyTypeObject *type, PyOb return NULL; } map_size = (Py_ssize_t) (st.st_size - offset); - } else if (offset + (size_t)map_size > st.st_size) { + } else if (offset + (size_t)map_size > (size_t)st.st_size) { PyErr_SetString(PyExc_ValueError, "mmap length is greater than file size"); return NULL; diff -r 2c70897e5f98 Modules/posixmodule.c --- a/Modules/posixmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/posixmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -902,7 +902,7 @@ path_converter(PyObject *o, void *p) { #endif narrow = PyBytes_AS_STRING(bytes); - if (length != strlen(narrow)) { + if ((size_t)length != strlen(narrow)) { FORMAT_EXCEPTION(PyExc_ValueError, "embedded NUL character in %s"); Py_DECREF(bytes); return 0; diff -r 2c70897e5f98 Modules/socketmodule.c --- a/Modules/socketmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Modules/socketmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -1248,7 +1248,7 @@ getsockaddrarg(PySocketSockObject *s, Py #ifdef linux if (len > 0 && path[0] == 0) { /* Linux abstract namespace extension */ - if (len > sizeof addr->sun_path) { + if (len > (int)sizeof addr->sun_path) { PyErr_SetString(PyExc_OSError, "AF_UNIX path too long"); goto unix_out; @@ -1258,7 +1258,7 @@ getsockaddrarg(PySocketSockObject *s, Py #endif /* linux */ { /* regular NULL-terminated string */ - if (len >= sizeof addr->sun_path) { + if (len >= (int)sizeof addr->sun_path) { PyErr_SetString(PyExc_OSError, "AF_UNIX path too long"); goto unix_out; @@ -1610,7 +1610,7 @@ getsockaddrarg(PySocketSockObject *s, Py if (len == 0) { ifr.ifr_ifindex = 0; - } else if (len < sizeof(ifr.ifr_name)) { + } else if (len < (Py_ssize_t)sizeof(ifr.ifr_name)) { strncpy(ifr.ifr_name, PyBytes_AS_STRING(interfaceName), sizeof(ifr.ifr_name)); ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) { @@ -4249,13 +4249,13 @@ gethost_common(struct hostent *h, struct switch (af) { case AF_INET: - if (alen < sizeof(struct sockaddr_in)) + if (alen < (int)sizeof(struct sockaddr_in)) return NULL; break; #ifdef ENABLE_IPV6 case AF_INET6: - if (alen < sizeof(struct sockaddr_in6)) + if (alen < (int)sizeof(struct sockaddr_in6)) return NULL; break; #endif @@ -4300,7 +4300,7 @@ gethost_common(struct hostent *h, struct memcpy(&sin.sin_addr, *pch, sizeof(sin.sin_addr)); tmp = makeipaddr((struct sockaddr *)&sin, sizeof(sin)); - if (pch == h->h_addr_list && alen >= sizeof(sin)) + if (pch == h->h_addr_list && alen >= (int)sizeof(sin)) memcpy((char *) addr, &sin, sizeof(sin)); break; } @@ -4318,7 +4318,7 @@ gethost_common(struct hostent *h, struct tmp = makeipaddr((struct sockaddr *)&sin6, sizeof(sin6)); - if (pch == h->h_addr_list && alen >= sizeof(sin6)) + if (pch == h->h_addr_list && alen >= (int)sizeof(sin6)) memcpy((char *) addr, &sin6, sizeof(sin6)); break; } diff -r 2c70897e5f98 Objects/bytesobject.c --- a/Objects/bytesobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/bytesobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -89,7 +89,7 @@ static PyObject * return (PyObject *)op; } - if (size > PY_SSIZE_T_MAX - PyBytesObject_SIZE) { + if (size > PY_SSIZE_T_MAX - (Py_ssize_t)PyBytesObject_SIZE) { PyErr_SetString(PyExc_OverflowError, "byte string is too large"); return NULL; @@ -1755,7 +1755,7 @@ bytes_count(PyBytesObject *self, PyObjec bytes.translate self: self(type="PyBytesObject *") - table: object + table: object Translation table, which must be a bytes object of length 256. [ deletechars: object @@ -3326,7 +3326,7 @@ PyBytes_Concat(PyObject **pv, PyObject * /* Only one reference, so we can resize in place */ Py_ssize_t oldsize; Py_buffer wb; - + wb.len = -1; if (_getbuffer(w, &wb) < 0) { PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", diff -r 2c70897e5f98 Objects/exceptions.c --- a/Objects/exceptions.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/exceptions.c Sat Aug 02 02:13:42 2014 +0200 @@ -2714,7 +2714,7 @@ PyObject * same_basic_size = ( caught_type_size == base_exc_size || (PyType_SUPPORTS_WEAKREFS(caught_type) && - (caught_type_size == base_exc_size + sizeof(PyObject *)) + (caught_type_size == base_exc_size + (Py_ssize_t)sizeof(PyObject *)) ) ); if (caught_type->tp_init != (initproc)BaseException_init || diff -r 2c70897e5f98 Objects/longobject.c --- a/Objects/longobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/longobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -5094,7 +5094,7 @@ int * to the original refcnt + 1 */ Py_REFCNT(op) = refcnt + 1; assert(Py_SIZE(op) == size); - assert(v->ob_digit[0] == abs(ival)); + assert(v->ob_digit[0] == (digit)abs(ival)); } else { (void)PyObject_INIT(v, &PyLong_Type); diff -r 2c70897e5f98 Objects/setobject.c --- a/Objects/setobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/setobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -771,7 +771,7 @@ frozenset_hash(PyObject *self) /* Make the final result spread-out in a different pattern than the algorithm for tuples or other python objects. */ hash = hash * 69069U + 907133923UL; - if (hash == -1) + if (hash == (Py_uhash_t)-1) hash = 590923713UL; so->hash = hash; return hash; diff -r 2c70897e5f98 Objects/tupleobject.c --- a/Objects/tupleobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/tupleobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -97,7 +97,7 @@ PyTuple_New(Py_ssize_t size) #endif { /* Check for overflow */ - if (size > (PY_SSIZE_T_MAX - sizeof(PyTupleObject) - + if ((size_t)size > (PY_SSIZE_T_MAX - sizeof(PyTupleObject) - sizeof(PyObject *)) / sizeof(PyObject *)) { return PyErr_NoMemory(); } diff -r 2c70897e5f98 Objects/typeobject.c --- a/Objects/typeobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/typeobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -2622,7 +2622,7 @@ PyType_FromSpecWithBases(PyType_Spec *sp type->tp_itemsize = spec->itemsize; for (slot = spec->slots; slot->slot; slot++) { - if (slot->slot >= Py_ARRAY_LENGTH(slotoffsets)) { + if (slot->slot >= (int)Py_ARRAY_LENGTH(slotoffsets)) { PyErr_SetString(PyExc_RuntimeError, "invalid slot offset"); goto fail; } @@ -2686,7 +2686,7 @@ PyType_GetSlot(PyTypeObject *type, int s PyErr_BadInternalCall(); return NULL; } - if (slot >= Py_ARRAY_LENGTH(slotoffsets)) { + if (slot >= (int)Py_ARRAY_LENGTH(slotoffsets)) { /* Extension module requesting slot from a future version */ return NULL; } diff -r 2c70897e5f98 Objects/unicodectype.c --- a/Objects/unicodectype.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/unicodectype.c Sat Aug 02 02:13:42 2014 +0200 @@ -27,7 +27,7 @@ #define EXTENDED_CASE_MASK 0x4000 typedef struct { - /* + /* These are either deltas to the character or offsets in _PyUnicode_ExtendedCase. */ diff -r 2c70897e5f98 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Objects/unicodeobject.c Sat Aug 02 02:13:42 2014 +0200 @@ -816,7 +816,7 @@ resize_inplace(PyObject *unicode, Py_ssi assert(_PyUnicode_WSTR(unicode) != NULL); /* check for integer overflow */ - if (length > PY_SSIZE_T_MAX / sizeof(wchar_t) - 1) { + if (length > PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) - 1) { PyErr_NoMemory(); return -1; } @@ -888,14 +888,14 @@ static PyUnicodeObject * } /* Ensure we won't overflow the size. */ - if (length > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) { - return (PyUnicodeObject *)PyErr_NoMemory(); - } if (length < 0) { PyErr_SetString(PyExc_SystemError, "Negative size passed to _PyUnicode_New"); return NULL; } + if ((size_t)length > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) { + return (PyUnicodeObject *)PyErr_NoMemory(); + } unicode = PyObject_New(PyUnicodeObject, &PyUnicode_Type); if (unicode == NULL) @@ -2239,7 +2239,7 @@ as_ucs4(PyObject *string, Py_UCS4 *targe if (copy_null) targetlen++; if (!target) { - if (PY_SSIZE_T_MAX / sizeof(Py_UCS4) < targetlen) { + if (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(Py_UCS4) < targetlen) { PyErr_NoMemory(); return NULL; } @@ -2852,7 +2852,7 @@ PyUnicode_AsWideCharString(PyObject *uni buflen = unicode_aswidechar(unicode, NULL, 0); if (buflen == -1) return NULL; - if (PY_SSIZE_T_MAX / sizeof(wchar_t) < buflen) { + if (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) < buflen) { PyErr_NoMemory(); return NULL; } @@ -3519,7 +3519,7 @@ PyUnicode_DecodeLocaleAndSize(const char if (locale_error_handler(errors, &surrogateescape) < 0) return NULL; - if (str[len] != '\0' || len != strlen(str)) { + if (str[len] != '\0' || (size_t)len != strlen(str)) { PyErr_SetString(PyExc_TypeError, "embedded null character"); return NULL; } @@ -3696,7 +3696,7 @@ PyUnicode_FSConverter(PyObject* arg, voi } size = PyBytes_GET_SIZE(output); data = PyBytes_AS_STRING(output); - if (size != strlen(data)) { + if ((size_t)size != strlen(data)) { PyErr_SetString(PyExc_TypeError, "embedded NUL character"); Py_DECREF(output); return 0; @@ -8879,7 +8879,7 @@ PyUnicode_TransformDecimalToASCII(Py_UNI int decimal = Py_UNICODE_TODECIMAL(ch); if (decimal >= 0) ch = '0' + decimal; - maxchar = Py_MAX(maxchar, ch); + maxchar = Py_MAX(maxchar, (Py_UCS4)ch); } } @@ -10833,7 +10833,7 @@ PyUnicode_CompareWithASCIIString(PyObjec void *data = PyUnicode_DATA(uni); /* Compare Unicode string and source character set string */ for (i = 0; (chr = PyUnicode_READ(kind, data, i)) && str[i]; i++) - if (chr != str[i]) + if (chr != (unsigned char)str[i]) return (chr < (unsigned char)(str[i])) ? -1 : 1; /* This check keeps Python strings that end in '\0' from comparing equal to C strings identical up to that point. */ @@ -15394,7 +15394,7 @@ PyUnicode_AsUnicodeCopy(PyObject *unicod if (u == NULL) return NULL; /* Ensure we won't overflow the size. */ - if (len > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) { + if ((size_t)len > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) { PyErr_NoMemory(); return NULL; } diff -r 2c70897e5f98 Python/asdl.c --- a/Python/asdl.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/asdl.c Sat Aug 02 02:13:42 2014 +0200 @@ -9,7 +9,7 @@ asdl_seq * /* check size is sane */ if (size < 0 || size == INT_MIN || - (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && ((size_t)(size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } @@ -40,7 +40,7 @@ asdl_int_seq * /* check size is sane */ if (size < 0 || size == INT_MIN || - (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && ((size_t)(size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } diff -r 2c70897e5f98 Python/bltinmodule.c --- a/Python/bltinmodule.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/bltinmodule.c Sat Aug 02 02:13:42 2014 +0200 @@ -581,7 +581,7 @@ source_as_string(PyObject *cmd, char *fu return NULL; } - if (strlen(str) != size) { + if (strlen(str) != (size_t)size) { PyErr_SetString(PyExc_TypeError, "source code string cannot contain null bytes"); return NULL; diff -r 2c70897e5f98 Python/getargs.c --- a/Python/getargs.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/getargs.c Sat Aug 02 02:13:42 2014 +0200 @@ -872,7 +872,7 @@ convertsimple(PyObject *arg, const char STORE_SIZE(count); format++; } else { - if (strlen(*p) != count) + if (strlen(*p) != (size_t)count) return converterr( "bytes without null bytes", arg, msgbuf, bufsize); @@ -994,7 +994,7 @@ convertsimple(PyObject *arg, const char *p = PyUnicode_AsUnicodeAndSize(arg, &len); if (*p == NULL) RETURN_ERR_OCCURRED; - if (Py_UNICODE_strlen(*p) != len) + if (Py_UNICODE_strlen(*p) != (size_t)len) return converterr( "str without null characters or None", arg, msgbuf, bufsize); diff -r 2c70897e5f98 Python/pythonrun.c --- a/Python/pythonrun.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/pythonrun.c Sat Aug 02 02:13:42 2014 +0200 @@ -1738,7 +1738,7 @@ print_error_text(PyObject *f, int offset return; if (offset >= 0) { - if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n') + if (offset > 0 && (size_t)offset == strlen(text) && text[offset - 1] == '\n') offset--; for (;;) { nl = strchr(text, '\n'); diff -r 2c70897e5f98 Python/thread.c --- a/Python/thread.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/thread.c Sat Aug 02 02:13:42 2014 +0200 @@ -431,7 +431,7 @@ PyThread_GetInfo(void) && defined(_CS_GNU_LIBPTHREAD_VERSION)) value = NULL; len = confstr(_CS_GNU_LIBPTHREAD_VERSION, buffer, sizeof(buffer)); - if (1 < len && len < sizeof(buffer)) { + if (1 < len && len < (int)sizeof(buffer)) { value = PyUnicode_DecodeFSDefaultAndSize(buffer, len-1); if (value == NULL) PyErr_Clear(); diff -r 2c70897e5f98 Python/thread_pthread.h --- a/Python/thread_pthread.h Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/thread_pthread.h Sat Aug 02 02:13:42 2014 +0200 @@ -608,7 +608,7 @@ PyThread_create_key(void) { pthread_key_t key; int fail = pthread_key_create(&key, NULL); - return fail ? -1 : key; + return fail ? -1 : (int)key; } void diff -r 2c70897e5f98 Python/traceback.c --- a/Python/traceback.c Fri Aug 01 21:57:49 2014 +0100 +++ b/Python/traceback.c Sat Aug 02 02:13:42 2014 +0200 @@ -198,7 +198,7 @@ static PyObject * } strcpy(namebuf, PyBytes_AS_STRING(path)); Py_DECREF(path); - if (strlen(namebuf) != len) + if (strlen(namebuf) != (size_t)len) continue; /* v contains '\0' */ if (len > 0 && namebuf[len-1] != SEP) namebuf[len++] = SEP;