Index: Python/ast.c =================================================================== --- Python/ast.c (revision 68145) +++ Python/ast.c (working copy) @@ -1640,7 +1640,7 @@ NCH(ppower) == 1 && TYPE((patom = CHILD(ppower, 0))) == atom && TYPE((pnum = CHILD(patom, 0))) == NUMBER) { - char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2); + char *s = (char *)PyObject_MALLOC(strlen(STR(pnum)) + 2); if (s == NULL) return NULL; s[0] = '-'; Index: Python/Python-ast.c =================================================================== --- Python/Python-ast.c (revision 68145) +++ Python/Python-ast.c (working copy) @@ -12,7 +12,6 @@ #include "Python.h" #include "Python-ast.h" -static PyTypeObject AST_type; static PyTypeObject *mod_type; static PyObject* ast2obj_mod(void*); static PyTypeObject *Module_type; Index: Objects/abstract.c =================================================================== --- Objects/abstract.c (revision 68145) +++ Objects/abstract.c (working copy) @@ -509,14 +509,14 @@ else { addone = _add_one_to_index_C; } - dest = buf; + dest = (char *)buf; /* XXX : This is not going to be the fastest code in the world several optimizations are possible. */ elements = len / view->itemsize; while (elements--) { addone(view->ndim, indices, view->shape); - ptr = PyBuffer_GetPointer(view, indices); + ptr = (char *)PyBuffer_GetPointer(view, indices); memcpy(dest, ptr, view->itemsize); dest += view->itemsize; } @@ -560,14 +560,14 @@ else { addone = _add_one_to_index_C; } - src = buf; + src = (char *)buf; /* XXX : This is not going to be the fastest code in the world several optimizations are possible. */ elements = len / view->itemsize; while (elements--) { addone(view->ndim, indices, view->shape); - ptr = PyBuffer_GetPointer(view, indices); + ptr = (char *)PyBuffer_GetPointer(view, indices); memcpy(ptr, src, view->itemsize); src += view->itemsize; } @@ -636,8 +636,8 @@ } while (elements--) { _add_one_to_index_C(view_src.ndim, indices, view_src.shape); - dptr = PyBuffer_GetPointer(&view_dest, indices); - sptr = PyBuffer_GetPointer(&view_src, indices); + dptr = (char *)PyBuffer_GetPointer(&view_dest, indices); + sptr = (char *)PyBuffer_GetPointer(&view_src, indices); memcpy(dptr, sptr, view_src.itemsize); } PyMem_Free(indices); Index: Objects/typeobject.c =================================================================== --- Objects/typeobject.c (revision 68145) +++ Objects/typeobject.c (working copy) @@ -6134,7 +6134,7 @@ /* We specifically allow __hash__ to be set to None to prevent inheritance of the default implementation from object.__hash__ */ - specific = PyObject_HashNotImplemented; + specific = (void *)PyObject_HashNotImplemented; } else { use_generic = 1; Index: Objects/unicodeobject.c =================================================================== --- Objects/unicodeobject.c (revision 68145) +++ Objects/unicodeobject.c (working copy) @@ -259,7 +259,7 @@ it contains). */ oldstr = unicode->str; - unicode->str = PyObject_REALLOC(unicode->str, + unicode->str = (Py_UNICODE *)PyObject_REALLOC(unicode->str, sizeof(Py_UNICODE) * (length + 1)); if (!unicode->str) { unicode->str = (Py_UNICODE *)oldstr; @@ -626,7 +626,7 @@ /* step 2: allocate memory for the results of * PyObject_Str()/PyObject_Repr() calls */ if (callcount) { - callresults = PyObject_Malloc(sizeof(PyObject *)*callcount); + callresults = (PyObject **)PyObject_Malloc(sizeof(PyObject *)*callcount); if (!callresults) { PyErr_NoMemory(); return NULL; @@ -773,7 +773,7 @@ } expand: if (abuffersize > 20) { - abuffer = PyObject_Malloc(abuffersize); + abuffer = (char *)PyObject_Malloc(abuffersize); if (!abuffer) { PyErr_NoMemory(); goto fail; @@ -4259,7 +4259,7 @@ } /* Create a three-level trie */ - result = PyObject_MALLOC(sizeof(struct encoding_map) + + result = (PyObject *)PyObject_MALLOC(sizeof(struct encoding_map) + 16*count2 + 128*count3 - 1); if (!result) return PyErr_NoMemory(); Index: Objects/descrobject.c =================================================================== --- Objects/descrobject.c (revision 68145) +++ Objects/descrobject.c (working copy) @@ -1212,8 +1212,8 @@ PyObject *doc) { propertyobject *pold = (propertyobject *)old; - propertyobject *pnew = NULL; - PyObject *new, *type; + propertyobject *pres = NULL; + PyObject *res, *type; type = PyObject_Type(old); if (type == NULL) @@ -1236,23 +1236,23 @@ doc = pold->prop_doc ? pold->prop_doc : Py_None; } - new = PyObject_CallFunction(type, "OOOO", get, set, del, doc); + res = PyObject_CallFunction(type, "OOOO", get, set, del, doc); Py_DECREF(type); - if (new == NULL) + if (res == NULL) return NULL; - pnew = (propertyobject *)new; + pres = (propertyobject *)res; if (pold->getter_doc && get != Py_None) { PyObject *get_doc = PyObject_GetAttrString(get, "__doc__"); if (get_doc != NULL) { - Py_XDECREF(pnew->prop_doc); - pnew->prop_doc = get_doc; /* get_doc already INCREF'd by GetAttr */ - pnew->getter_doc = 1; + Py_XDECREF(pres->prop_doc); + pres->prop_doc = get_doc; /* get_doc already INCREF'd by GetAttr */ + pres->getter_doc = 1; } else { PyErr_Clear(); } } - return new; + return res; } static int Index: Objects/fileobject.c =================================================================== --- Objects/fileobject.c (revision 68145) +++ Objects/fileobject.c (working copy) @@ -243,7 +243,7 @@ assert(f->f_fp == NULL); /* probably need to replace 'U' by 'rb' */ - newmode = PyMem_MALLOC(strlen(mode) + 3); + newmode = (char *)PyMem_MALLOC(strlen(mode) + 3); if (!newmode) { PyErr_NoMemory(); return NULL; @@ -1025,7 +1025,7 @@ return err_iterbuffered(); if (!PyArg_ParseTuple(args, "w*", &pbuf)) return NULL; - ptr = pbuf.buf; + ptr = (char *)pbuf.buf; ntodo = pbuf.len; ndone = 0; while (ntodo > 0) { @@ -1631,7 +1631,7 @@ if (f->f_binary) { if (!PyArg_ParseTuple(args, "s*", &pbuf)) return NULL; - s = pbuf.buf; + s = (char *)pbuf.buf; n = pbuf.len; } else if (!PyArg_ParseTuple(args, "t#", &s, &n)) @@ -1974,7 +1974,7 @@ static int set_softspace(PyFileObject *f, PyObject *value) { - int new; + int ival; if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0) return -1; @@ -1984,10 +1984,10 @@ return -1; } - new = PyInt_AsLong(value); - if (new == -1 && PyErr_Occurred()) + ival = PyInt_AsLong(value); + if (ival == -1 && PyErr_Occurred()) return -1; - f->f_softspace = new; + f->f_softspace = ival; return 0; } @@ -2343,7 +2343,7 @@ if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { char *cenc = PyString_AS_STRING(enc); - char *errors = fobj->f_errors == Py_None ? + const char *errors = fobj->f_errors == Py_None ? "strict" : PyString_AS_STRING(fobj->f_errors); value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) Index: Objects/exceptions.c =================================================================== --- Objects/exceptions.c (revision 68145) +++ Objects/exceptions.c (working copy) @@ -1150,7 +1150,7 @@ if (have_filename) bufsize += PyString_GET_SIZE(self->filename); - buffer = PyMem_MALLOC(bufsize); + buffer = (char *)PyMem_MALLOC(bufsize); if (buffer == NULL) return str; Index: Objects/frameobject.c =================================================================== --- Objects/frameobject.c (revision 68145) +++ Objects/frameobject.c (working copy) @@ -33,16 +33,16 @@ } \ Py_RETURN_NONE; \ } \ -static int frame_set_ ## NAME(PyFrameObject *f, PyObject *new) { \ +static int frame_set_ ## NAME(PyFrameObject *f, PyObject *newobj) { \ if (PyErr_WarnPy3k(#NAME " has been removed in 3.x", 2) < 0) \ return -1; \ if (f->NAME) { \ Py_CLEAR(f->NAME); \ } \ - if (new == Py_None) \ - new = NULL; \ - Py_XINCREF(new); \ - f->NAME = new; \ + if (newobj == Py_None) \ + newobj = NULL; \ + Py_XINCREF(newobj); \ + f->NAME = newobj; \ return 0; \ } @@ -654,7 +654,7 @@ Py_INCREF(builtins); } if (code->co_zombieframe != NULL) { - f = code->co_zombieframe; + f = (PyFrameObject *)code->co_zombieframe; code->co_zombieframe = NULL; _Py_NewReference((PyObject *)f); assert(f->f_code == code); Index: Objects/longobject.c =================================================================== --- Objects/longobject.c (revision 68145) +++ Objects/longobject.c (working copy) @@ -1874,7 +1874,7 @@ carry += v->ob_digit[i+k] - z + ((twodigits)zz << PyLong_SHIFT); v->ob_digit[i+k] = (digit)(carry & PyLong_MASK); - carry = Py_ARITHMETIC_RIGHT_SHIFT(PyLong_BASE_TWODIGITS_TYPE, + carry = Py_ARITHMETIC_RIGHT_SHIFT(stwodigits, carry, PyLong_SHIFT); carry -= zz; } @@ -1894,7 +1894,7 @@ carry += v->ob_digit[i+k] + w->ob_digit[i]; v->ob_digit[i+k] = (digit)(carry & PyLong_MASK); carry = Py_ARITHMETIC_RIGHT_SHIFT( - PyLong_BASE_TWODIGITS_TYPE, + stwodigits, carry, PyLong_SHIFT); } } Index: Objects/bytearrayobject.c =================================================================== --- Objects/bytearrayobject.c (revision 68145) +++ Objects/bytearrayobject.c (working copy) @@ -114,7 +114,7 @@ bytes_getbuffer(PyByteArrayObject *obj, Py_buffer *view, int flags) { int ret; - void *ptr; + char *ptr; if (view == NULL) { obj->ob_exports++; return 0; @@ -177,7 +177,7 @@ PyObject * PyByteArray_FromStringAndSize(const char *bytes, Py_ssize_t size) { - PyByteArrayObject *new; + PyByteArrayObject *newobj; Py_ssize_t alloc; if (size < 0) { @@ -186,30 +186,30 @@ return NULL; } - new = PyObject_New(PyByteArrayObject, &PyByteArray_Type); - if (new == NULL) + newobj = PyObject_New(PyByteArrayObject, &PyByteArray_Type); + if (newobj == NULL) return NULL; if (size == 0) { - new->ob_bytes = NULL; + newobj->ob_bytes = NULL; alloc = 0; } else { alloc = size + 1; - new->ob_bytes = PyMem_Malloc(alloc); - if (new->ob_bytes == NULL) { - Py_DECREF(new); + newobj->ob_bytes = (char *)PyMem_Malloc(alloc); + if (newobj->ob_bytes == NULL) { + Py_DECREF(newobj); return PyErr_NoMemory(); } if (bytes != NULL) - memcpy(new->ob_bytes, bytes, size); - new->ob_bytes[size] = '\0'; /* Trailing null byte */ + memcpy(newobj->ob_bytes, bytes, size); + newobj->ob_bytes[size] = '\0'; /* Trailing null byte */ } - Py_SIZE(new) = size; - new->ob_alloc = alloc; - new->ob_exports = 0; + Py_SIZE(newobj) = size; + newobj->ob_alloc = alloc; + newobj->ob_exports = 0; - return (PyObject *)new; + return (PyObject *)newobj; } Py_ssize_t @@ -272,7 +272,7 @@ return -1; } - ((PyByteArrayObject *)self)->ob_bytes = sval; + ((PyByteArrayObject *)self)->ob_bytes = (char *)sval; Py_SIZE(self) = size; ((PyByteArrayObject *)self)->ob_alloc = alloc; ((PyByteArrayObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */ @@ -784,7 +784,7 @@ } if (PyBytes_Check(arg)) { - PyObject *new, *encoded; + PyObject *newobj, *encoded; if (encoding != NULL) { encoded = PyCodec_Encode(arg, encoding, errors); if (encoded == NULL) @@ -795,17 +795,17 @@ encoded = arg; Py_INCREF(arg); } - new = bytes_iconcat(self, arg); + newobj = bytes_iconcat(self, arg); Py_DECREF(encoded); - if (new == NULL) + if (newobj == NULL) return -1; - Py_DECREF(new); + Py_DECREF(newobj); return 0; } if (PyUnicode_Check(arg)) { /* Encode via the codec registry */ - PyObject *encoded, *new; + PyObject *encoded, *newobj; if (encoding == NULL) { PyErr_SetString(PyExc_TypeError, "unicode argument without an encoding"); @@ -815,11 +815,11 @@ if (encoded == NULL) return -1; assert(PyBytes_Check(encoded)); - new = bytes_iconcat(self, encoded); + newobj = bytes_iconcat(self, encoded); Py_DECREF(encoded); - if (new == NULL) + if (newobj == NULL) return -1; - Py_DECREF(new); + Py_DECREF(newobj); return 0; } @@ -924,7 +924,7 @@ /* 14 == strlen(quote_prefix) + 2 + strlen(quote_postfix) */ size_t newsize = 14 + 4 * length; PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 - 3 != length) { + if (newsize > (size_t)PY_SSIZE_T_MAX || newsize / 4 - 3 != (size_t)length) { PyErr_SetString(PyExc_OverflowError, "bytearray object is too large to make repr"); return NULL; @@ -1159,11 +1159,11 @@ if (dir > 0) res = stringlib_find_slice( PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - subbuf.buf, subbuf.len, start, end); + (char *)subbuf.buf, subbuf.len, start, end); else res = stringlib_rfind_slice( PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - subbuf.buf, subbuf.len, start, end); + (char *)subbuf.buf, subbuf.len, start, end); PyBuffer_Release(&subbuf); return res; } @@ -1212,7 +1212,7 @@ _adjust_indices(&start, &end, PyByteArray_GET_SIZE(self)); count_obj = PyInt_FromSsize_t( - stringlib_count(str + start, end - start, vsub.buf, vsub.len) + stringlib_count(str + start, end - start, (char *)vsub.buf, vsub.len) ); PyBuffer_Release(&vsub); return count_obj; @@ -1289,7 +1289,7 @@ if (_getbuffer(arg, &varg) < 0) return -1; pos = stringlib_find(PyByteArray_AS_STRING(self), Py_SIZE(self), - varg.buf, varg.len, 0); + (char *)varg.buf, varg.len, 0); PyBuffer_Release(&varg); return pos >= 0; } @@ -2140,8 +2140,8 @@ } res = (PyObject *)replace((PyByteArrayObject *) self, - vfrom.buf, vfrom.len, - vto.buf, vto.len, count); + (char *)vfrom.buf, vfrom.len, + (char *)vto.buf, vto.len, count); PyBuffer_Release(&vfrom); PyBuffer_Release(&vto); @@ -2295,7 +2295,7 @@ if (_getbuffer(subobj, &vsub) < 0) return NULL; - sub = vsub.buf; + sub = (char *)vsub.buf; n = vsub.len; if (n == 0) { @@ -2359,14 +2359,14 @@ assert(PyTuple_GET_SIZE(result) == 3); for (i = 0; i < 3; i++) { if (PyTuple_GET_ITEM(result, i) == (PyObject *)nullbytes) { - PyObject *new = PyByteArray_FromStringAndSize(NULL, 0); - if (new == NULL) { + PyObject *newobj = PyByteArray_FromStringAndSize(NULL, 0); + if (newobj == NULL) { Py_DECREF(result); result = NULL; break; } Py_DECREF(nullbytes); - PyTuple_SET_ITEM(result, i, new); + PyTuple_SET_ITEM(result, i, newobj); } } } @@ -2530,7 +2530,7 @@ if (_getbuffer(subobj, &vsub) < 0) return NULL; - sub = vsub.buf; + sub = (char *)vsub.buf; n = vsub.len; if (n == 0) { @@ -2828,22 +2828,22 @@ bytes_strip(PyByteArrayObject *self, PyObject *args) { Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; + unsigned char *myptr, *argptr; PyObject *arg = Py_None; Py_buffer varg; if (!PyArg_ParseTuple(args, "|O:strip", &arg)) return NULL; if (arg == Py_None) { - argptr = "\t\n\r\f\v "; + argptr = (unsigned char *)"\t\n\r\f\v "; argsize = 6; } else { if (_getbuffer(arg, &varg) < 0) return NULL; - argptr = varg.buf; + argptr = (unsigned char *)varg.buf; argsize = varg.len; } - myptr = self->ob_bytes; + myptr = (unsigned char *)self->ob_bytes; mysize = Py_SIZE(self); left = lstrip_helper(myptr, mysize, argptr, argsize); if (left == mysize) @@ -2864,22 +2864,22 @@ bytes_lstrip(PyByteArrayObject *self, PyObject *args) { Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; + unsigned char *myptr, *argptr; PyObject *arg = Py_None; Py_buffer varg; if (!PyArg_ParseTuple(args, "|O:lstrip", &arg)) return NULL; if (arg == Py_None) { - argptr = "\t\n\r\f\v "; + argptr = (unsigned char *)"\t\n\r\f\v "; argsize = 6; } else { if (_getbuffer(arg, &varg) < 0) return NULL; - argptr = varg.buf; + argptr = (unsigned char *)varg.buf; argsize = varg.len; } - myptr = self->ob_bytes; + myptr = (unsigned char *)self->ob_bytes; mysize = Py_SIZE(self); left = lstrip_helper(myptr, mysize, argptr, argsize); right = mysize; @@ -2897,22 +2897,22 @@ bytes_rstrip(PyByteArrayObject *self, PyObject *args) { Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; + unsigned char *myptr, *argptr; PyObject *arg = Py_None; Py_buffer varg; if (!PyArg_ParseTuple(args, "|O:rstrip", &arg)) return NULL; if (arg == Py_None) { - argptr = "\t\n\r\f\v "; + argptr = (unsigned char *)"\t\n\r\f\v "; argsize = 6; } else { if (_getbuffer(arg, &varg) < 0) return NULL; - argptr = varg.buf; + argptr = (unsigned char *)varg.buf; argsize = varg.len; } - myptr = self->ob_bytes; + myptr = (unsigned char *)self->ob_bytes; mysize = Py_SIZE(self); left = 0; right = rstrip_helper(myptr, mysize, argptr, argsize); Index: Parser/tokenizer.c =================================================================== --- Parser/tokenizer.c (revision 68145) +++ Parser/tokenizer.c (working copy) @@ -1611,7 +1611,7 @@ if (lineobj != NULL) { int linelen = PyString_Size(lineobj); const char *line = PyString_AsString(lineobj); - text = PyObject_MALLOC(linelen + 1); + text = (char *)PyObject_MALLOC(linelen + 1); if (text != NULL && line != NULL) { if (linelen) strncpy(text, line, linelen); Index: Modules/signalmodule.c =================================================================== --- Modules/signalmodule.c (revision 68145) +++ Modules/signalmodule.c (working copy) @@ -400,20 +400,20 @@ double first; double interval = 0; int which; - struct itimerval new, old; + struct itimerval newval, oldval; if(!PyArg_ParseTuple(args, "id|d:setitimer", &which, &first, &interval)) return NULL; - timeval_from_double(first, &new.it_value); - timeval_from_double(interval, &new.it_interval); + timeval_from_double(first, &newval.it_value); + timeval_from_double(interval, &newval.it_interval); /* Let OS check "which" value */ - if (setitimer(which, &new, &old) != 0) { + if (setitimer(which, &newval, &oldval) != 0) { PyErr_SetFromErrno(ItimerError); return NULL; } - return itimer_retval(&old); + return itimer_retval(&oldval); } PyDoc_STRVAR(setitimer_doc, Index: Modules/_codecsmodule.c =================================================================== --- Modules/_codecsmodule.c (revision 68145) +++ Modules/_codecsmodule.c (working copy) @@ -243,7 +243,7 @@ return NULL; consumed = pbuf.len; - decoded = PyUnicode_DecodeUTF7Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF7Stateful((char *)pbuf.buf, pbuf.len, errors, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -266,7 +266,7 @@ return NULL; consumed = pbuf.len; - decoded = PyUnicode_DecodeUTF8Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF8Stateful((char *)pbuf.buf, pbuf.len, errors, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -289,7 +289,7 @@ &pbuf, &errors, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF16Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -313,7 +313,7 @@ return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF16Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -337,7 +337,7 @@ return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF16Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -368,7 +368,7 @@ &pbuf, &errors, &byteorder, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - unicode = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors, + unicode = PyUnicode_DecodeUTF16Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (unicode == NULL) @@ -393,7 +393,7 @@ &pbuf, &errors, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF32Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -416,7 +416,7 @@ &pbuf, &errors, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF32Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -439,7 +439,7 @@ &pbuf, &errors, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors, + decoded = PyUnicode_DecodeUTF32Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (decoded == NULL) @@ -470,7 +470,7 @@ &pbuf, &errors, &byteorder, &final)) return NULL; consumed = pbuf.len; /* This is overwritten unless final is true. */ - unicode = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors, + unicode = PyUnicode_DecodeUTF32Stateful((char *)pbuf.buf, pbuf.len, errors, &byteorder, final ? NULL : &consumed); PyBuffer_Release(&pbuf); if (unicode == NULL) @@ -492,7 +492,7 @@ &pbuf, &errors)) return NULL; - unicode = PyUnicode_DecodeUnicodeEscape(pbuf.buf, pbuf.len, errors); + unicode = PyUnicode_DecodeUnicodeEscape((char *)pbuf.buf, pbuf.len, errors); PyBuffer_Release(&pbuf); return codec_tuple(unicode, pbuf.len); } @@ -509,7 +509,7 @@ &pbuf, &errors)) return NULL; - unicode = PyUnicode_DecodeRawUnicodeEscape(pbuf.buf, pbuf.len, errors); + unicode = PyUnicode_DecodeRawUnicodeEscape((char *)pbuf.buf, pbuf.len, errors); PyBuffer_Release(&pbuf); return codec_tuple(unicode, pbuf.len); } @@ -526,7 +526,7 @@ &pbuf, &errors)) return NULL; - unicode = PyUnicode_DecodeLatin1(pbuf.buf, pbuf.len, errors); + unicode = PyUnicode_DecodeLatin1((char *)pbuf.buf, pbuf.len, errors); PyBuffer_Release(&pbuf); return codec_tuple(unicode, pbuf.len); } @@ -543,7 +543,7 @@ &pbuf, &errors)) return NULL; - unicode = PyUnicode_DecodeASCII(pbuf.buf, pbuf.len, errors); + unicode = PyUnicode_DecodeASCII((char *)pbuf.buf, pbuf.len, errors); PyBuffer_Release(&pbuf); return codec_tuple(unicode, pbuf.len); } @@ -563,7 +563,7 @@ if (mapping == Py_None) mapping = NULL; - unicode = PyUnicode_DecodeCharmap(pbuf.buf, pbuf.len, mapping, errors); + unicode = PyUnicode_DecodeCharmap((char *)pbuf.buf, pbuf.len, mapping, errors); PyBuffer_Release(&pbuf); return codec_tuple(unicode, pbuf.len); } Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (revision 68145) +++ Modules/posixmodule.c (working copy) @@ -1960,7 +1960,8 @@ Py_BEGIN_ALLOW_THREADS do { bufsize = bufsize + bufsize_incr; - tmpbuf = malloc(bufsize); + /* XXX: Why not PyMem_MALLOC ? */ + tmpbuf = (char *)malloc(bufsize); if (tmpbuf == NULL) { break; } @@ -6409,7 +6410,7 @@ return NULL; /* Sanitize mode. See fileobject.c */ - mode = PyMem_MALLOC(strlen(orgmode)+3); + mode = (char *)PyMem_MALLOC(strlen(orgmode)+3); if (!mode) { PyErr_NoMemory(); return NULL;