diff -r 4d5143ff58ea Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/dict.rst Mon Oct 14 23:36:08 2013 +0300 @@ -84,7 +84,7 @@ on failure. -.. c:function:: int PyDict_DelItemString(PyObject *p, char *key) +.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key) Remove the entry in dictionary *p* which has a key specified by the string *key*. Return ``0`` on success or ``-1`` on failure. diff -r 4d5143ff58ea Doc/c-api/file.rst --- a/Doc/c-api/file.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/file.rst Mon Oct 14 23:36:08 2013 +0300 @@ -17,7 +17,7 @@ the :mod:`io` APIs instead. -.. c:function:: PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding, char *errors, char *newline, int closefd) +.. c:function:: PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding, const char *errors, const char *newline, int closefd) Create a Python file object from the file descriptor of an already opened file *fd*. The arguments *name*, *encoding*, *errors* and *newline* diff -r 4d5143ff58ea Doc/c-api/import.rst --- a/Doc/c-api/import.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/import.rst Mon Oct 14 23:36:08 2013 +0300 @@ -118,7 +118,7 @@ encoded string instead of a Unicode object. -.. c:function:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co) +.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co) .. index:: builtin: compile @@ -145,7 +145,7 @@ :c:func:`PyImport_ExecCodeModuleWithPathnames`. -.. c:function:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) +.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname) Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of the module object is set to *pathname* if it is non-``NULL``. @@ -162,7 +162,7 @@ .. versionadded:: 3.3 -.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname) +.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname) Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and *cpathname* are UTF-8 encoded strings. Attempts are also made to figure out @@ -246,7 +246,7 @@ .. versionadded:: 3.3 -.. c:function:: int PyImport_ImportFrozenModule(char *name) +.. c:function:: int PyImport_ImportFrozenModule(const char *name) Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a UTF-8 encoded string instead of a Unicode object. diff -r 4d5143ff58ea Doc/c-api/long.rst --- a/Doc/c-api/long.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/long.rst Mon Oct 14 23:36:08 2013 +0300 @@ -80,7 +80,7 @@ *NULL* on failure. -.. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base) +.. c:function:: PyObject* PyLong_FromString(const char *str, char **pend, int base) Return a new :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*. If *pend* is non-*NULL*, diff -r 4d5143ff58ea Doc/c-api/mapping.rst --- a/Doc/c-api/mapping.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/mapping.rst Mon Oct 14 23:36:08 2013 +0300 @@ -22,7 +22,7 @@ expression ``len(o)``. -.. c:function:: int PyMapping_DelItemString(PyObject *o, char *key) +.. c:function:: int PyMapping_DelItemString(PyObject *o, const char *key) Remove the mapping for object *key* from the object *o*. Return ``-1`` on failure. This is equivalent to the Python statement ``del o[key]``. @@ -67,13 +67,13 @@ the Python expression ``list(o.items())``. -.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, char *key) +.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, const char *key) Return element of *o* corresponding to the object *key* or *NULL* on failure. This is the equivalent of the Python expression ``o[key]``. -.. c:function:: int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v) +.. c:function:: int PyMapping_SetItemString(PyObject *o, const char *key, PyObject *v) Map the object *key* to the value *v* in object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[key] = v``. diff -r 4d5143ff58ea Doc/c-api/veryhigh.rst --- a/Doc/c-api/veryhigh.rst Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/c-api/veryhigh.rst Mon Oct 14 23:36:08 2013 +0300 @@ -155,7 +155,7 @@ Python source code. -.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *) +.. c:var:: char* (*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *) Can be set to point to a function with the prototype ``char *func(FILE *stdin, FILE *stdout, char *prompt)``, diff -r 4d5143ff58ea Doc/data/refcounts.dat --- a/Doc/data/refcounts.dat Mon Oct 14 21:19:24 2013 +0300 +++ b/Doc/data/refcounts.dat Mon Oct 14 23:36:08 2013 +0300 @@ -508,13 +508,13 @@ PyImport_Cleanup:void::: PyImport_ExecCodeModule:PyObject*::+1: -PyImport_ExecCodeModule:char*:name:: +PyImport_ExecCodeModule:const char*:name:: PyImport_ExecCodeModule:PyObject*:co:0: PyImport_ExecCodeModuleEx:PyObject*::+1: -PyImport_ExecCodeModuleEx:char*:name:: +PyImport_ExecCodeModuleEx:const char*:name:: PyImport_ExecCodeModuleEx:PyObject*:co:0: -PyImport_ExecCodeModuleEx:char*:pathname:: +PyImport_ExecCodeModuleEx:const char*:pathname:: PyImport_GetMagicNumber:long::: @@ -524,7 +524,7 @@ PyImport_Import:PyObject*:name:0: PyImport_ImportFrozenModule:int::: -PyImport_ImportFrozenModule:char*::: +PyImport_ImportFrozenModule:const char*::: PyImport_ImportModule:PyObject*::+1: PyImport_ImportModule:const char*:name:: @@ -673,7 +673,7 @@ PyLong_FromUnsignedLongLong:unsigned long long:v:: PyLong_FromString:PyObject*::+1: -PyLong_FromString:char*:str:: +PyLong_FromString:const char*:str:: PyLong_FromString:char**:pend:: PyLong_FromString:int:base:: @@ -701,7 +701,7 @@ PyMapping_GetItemString:PyObject*::+1: PyMapping_GetItemString:PyObject*:o:0: -PyMapping_GetItemString:char*:key:: +PyMapping_GetItemString:const char*:key:: PyMapping_HasKey:int::: PyMapping_HasKey:PyObject*:o:0: @@ -709,7 +709,7 @@ PyMapping_HasKeyString:int::: PyMapping_HasKeyString:PyObject*:o:0: -PyMapping_HasKeyString:char*:key:: +PyMapping_HasKeyString:const char*:key:: PyMapping_Items:PyObject*::+1: PyMapping_Items:PyObject*:o:0: @@ -722,7 +722,7 @@ PyMapping_SetItemString:int::: PyMapping_SetItemString:PyObject*:o:0: -PyMapping_SetItemString:char*:key:: +PyMapping_SetItemString:const char*:key:: PyMapping_SetItemString:PyObject*:v:+1: PyMapping_Values:PyObject*::+1: @@ -735,7 +735,7 @@ PyMarshal_ReadObjectFromFile:FILE*:file:: PyMarshal_ReadObjectFromString:PyObject*::+1: -PyMarshal_ReadObjectFromString:char*:string:: +PyMarshal_ReadObjectFromString:const char*:string:: PyMarshal_ReadObjectFromString:int:len:: PyMarshal_WriteObjectToString:PyObject*::+1: diff -r 4d5143ff58ea Include/abstract.h --- a/Include/abstract.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/abstract.h Mon Oct 14 23:36:08 2013 +0300 @@ -144,7 +144,7 @@ /* Implemented elsewhere: - int PyObject_HasAttrString(PyObject *o, char *attr_name); + int PyObject_HasAttrString(PyObject *o, const char *attr_name); Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression: @@ -156,7 +156,7 @@ /* Implemented elsewhere: - PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name); + PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); Retrieve an attributed named attr_name form object o. Returns the attribute value on success, or NULL on failure. @@ -189,7 +189,7 @@ /* Implemented elsewhere: - int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v); + int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); Set the value of the attribute named attr_name, for object o, to the value, v. Returns -1 on failure. This is @@ -209,7 +209,7 @@ /* implemented as a macro: - int PyObject_DelAttrString(PyObject *o, char *attr_name); + int PyObject_DelAttrString(PyObject *o, const char *attr_name); Delete attribute named attr_name, for object o. Returns -1 on failure. This is the equivalent of the Python @@ -434,7 +434,7 @@ statement: o[key]=v. */ - PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key); + PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); /* Remove the mapping for object, key, from the object *o. @@ -1156,7 +1156,7 @@ /* implemented as a macro: - int PyMapping_DelItemString(PyObject *o, char *key); + int PyMapping_DelItemString(PyObject *o, const char *key); Remove the mapping for object, key, from the object *o. Returns -1 on failure. This is equivalent to @@ -1174,7 +1174,7 @@ */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) - PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key); + PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); /* On success, return 1 if the mapping object has the key, key, @@ -1218,7 +1218,8 @@ */ - PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); + PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, + const char *key); /* Return element of o corresponding to the object, key, or NULL @@ -1226,7 +1227,7 @@ o[key]. */ - PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key, + PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value); /* diff -r 4d5143ff58ea Include/fileobject.h --- a/Include/fileobject.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/fileobject.h Mon Oct 14 23:36:08 2013 +0300 @@ -8,8 +8,9 @@ #define PY_STDIOTEXTMODE "b" -PyAPI_FUNC(PyObject *) PyFile_FromFd(int, char *, char *, int, char *, char *, - char *, int); +PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int, + const char *, const char *, + const char *, int); PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); diff -r 4d5143ff58ea Include/grammar.h --- a/Include/grammar.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/grammar.h Mon Oct 14 23:36:08 2013 +0300 @@ -69,13 +69,13 @@ /* FUNCTIONS */ grammar *newgrammar(int start); -dfa *adddfa(grammar *g, int type, char *name); +dfa *adddfa(grammar *g, int type, const char *name); int addstate(dfa *d); void addarc(dfa *d, int from, int to, int lbl); dfa *PyGrammar_FindDFA(grammar *g, int type); -int addlabel(labellist *ll, int type, char *str); -int findlabel(labellist *ll, int type, char *str); +int addlabel(labellist *ll, int type, const char *str); +int findlabel(labellist *ll, int type, const char *str); const char *PyGrammar_LabelRepr(label *lb); void translatelabels(grammar *g); diff -r 4d5143ff58ea Include/import.h --- a/Include/import.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/import.h Mon Oct 14 23:36:08 2013 +0300 @@ -13,19 +13,19 @@ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( - char *name, /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ PyObject *co ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( - char *name, /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ PyObject *co, - char *pathname /* decoded from the filesystem encoding */ + const char *pathname /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( - char *name, /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ PyObject *co, - char *pathname, /* decoded from the filesystem encoding */ - char *cpathname /* decoded from the filesystem encoding */ + const char *pathname, /* decoded from the filesystem encoding */ + const char *cpathname /* decoded from the filesystem encoding */ ); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, @@ -72,7 +72,7 @@ PyObject *name ); PyAPI_FUNC(int) PyImport_ImportFrozenModule( - char *name /* UTF-8 encoded string */ + const char *name /* UTF-8 encoded string */ ); #ifndef Py_LIMITED_API @@ -92,12 +92,12 @@ PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *); PyAPI_FUNC(int)_PyImport_FixupBuiltin( PyObject *mod, - char *name /* UTF-8 encoded string */ + const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); struct _inittab { - char *name; /* ASCII encoded string */ + const char *name; /* ASCII encoded string */ PyObject* (*initfunc)(void); }; PyAPI_DATA(struct _inittab *) PyImport_Inittab; diff -r 4d5143ff58ea Include/longobject.h --- a/Include/longobject.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/longobject.h Mon Oct 14 23:36:08 2013 +0300 @@ -93,7 +93,7 @@ PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); #endif /* HAVE_LONG_LONG */ -PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); +PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base); @@ -189,8 +189,8 @@ /* These aren't really part of the int object, but they're handy. The functions are in Python/mystrtoul.c. */ -PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); -PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); +PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int); +PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int); #ifdef __cplusplus } diff -r 4d5143ff58ea Include/marshal.h --- a/Include/marshal.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/marshal.h Mon Oct 14 23:36:08 2013 +0300 @@ -19,7 +19,8 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); #endif -PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, + Py_ssize_t); #ifdef __cplusplus } diff -r 4d5143ff58ea Include/parsetok.h --- a/Include/parsetok.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/parsetok.h Mon Oct 14 23:36:08 2013 +0300 @@ -38,7 +38,8 @@ PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, perrdetail *); PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, - char *, char *, perrdetail *); + const char *, const char *, + perrdetail *); PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, perrdetail *, int); @@ -48,8 +49,8 @@ const char *enc, grammar *g, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, perrdetail *err_ret, int flags); PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( @@ -58,8 +59,8 @@ const char *enc, grammar *g, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, perrdetail *err_ret, int *flags); PyAPI_FUNC(node *) PyParser_ParseFileObject( @@ -68,8 +69,8 @@ const char *enc, grammar *g, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, perrdetail *err_ret, int *flags); diff -r 4d5143ff58ea Include/pyport.h --- a/Include/pyport.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/pyport.h Mon Oct 14 23:36:08 2013 +0300 @@ -673,8 +673,10 @@ /* BSDI does not supply a prototype for the 'openpty' and 'forkpty' functions, even though they are included in libutil. */ #include -extern int openpty(int *, int *, char *, struct termios *, struct winsize *); -extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); +extern int openpty(int *, int *, char *, + const struct termios *, const struct winsize *); +extern pid_t forkpty(int *, char *, + const struct termios *, const struct winsize *); #endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ diff -r 4d5143ff58ea Include/pythonrun.h --- a/Include/pythonrun.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Include/pythonrun.h Mon Oct 14 23:36:08 2013 +0300 @@ -253,10 +253,10 @@ /* Stuff with no proper home (yet) */ #ifndef Py_LIMITED_API -PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); +PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); #endif PyAPI_DATA(int) (*PyOS_InputHook)(void); -PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); +PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); #ifndef Py_LIMITED_API PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; #endif diff -r 4d5143ff58ea Modules/_sqlite/statement.c --- a/Modules/_sqlite/statement.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Modules/_sqlite/statement.c Mon Oct 14 23:36:08 2013 +0300 @@ -248,7 +248,7 @@ current_param = PyDict_GetItemString(parameters, binding_name); Py_XINCREF(current_param); } else { - current_param = PyMapping_GetItemString(parameters, (char*)binding_name); + current_param = PyMapping_GetItemString(parameters, binding_name); } if (!current_param) { PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i); diff -r 4d5143ff58ea Modules/cjkcodecs/cjkcodecs.h --- a/Modules/cjkcodecs/cjkcodecs.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Modules/cjkcodecs/cjkcodecs.h Mon Oct 14 23:36:08 2013 +0300 @@ -371,7 +371,7 @@ { PyObject *o, *mod; - mod = PyImport_ImportModule((char *)modname); + mod = PyImport_ImportModule(modname); if (mod == NULL) return -1; diff -r 4d5143ff58ea Modules/readline.c --- a/Modules/readline.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Modules/readline.c Mon Oct 14 23:36:08 2013 +0300 @@ -1043,7 +1043,7 @@ extern PyThreadState* _PyOS_ReadlineTState; static char * -readline_until_enter_or_signal(char *prompt, int *signal) +readline_until_enter_or_signal(const char *prompt, int *signal) { char * not_done_reading = ""; fd_set selectset; @@ -1145,7 +1145,7 @@ static char * -call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) +call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) { size_t n; char *p, *q; diff -r 4d5143ff58ea Objects/abstract.c --- a/Objects/abstract.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/abstract.c Mon Oct 14 23:36:08 2013 +0300 @@ -223,7 +223,7 @@ } int -PyObject_DelItemString(PyObject *o, char *key) +PyObject_DelItemString(PyObject *o, const char *key) { PyObject *okey; int ret; @@ -1950,7 +1950,7 @@ #define PyMapping_Length PyMapping_Size PyObject * -PyMapping_GetItemString(PyObject *o, char *key) +PyMapping_GetItemString(PyObject *o, const char *key) { PyObject *okey, *r; @@ -1966,7 +1966,7 @@ } int -PyMapping_SetItemString(PyObject *o, char *key, PyObject *value) +PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value) { PyObject *okey; int r; @@ -1985,7 +1985,7 @@ } int -PyMapping_HasKeyString(PyObject *o, char *key) +PyMapping_HasKeyString(PyObject *o, const char *key) { PyObject *v; diff -r 4d5143ff58ea Objects/bytesobject.c --- a/Objects/bytesobject.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/bytesobject.c Mon Oct 14 23:36:08 2013 +0300 @@ -1347,7 +1347,7 @@ { PyObject *sep = NULL; - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) + if (!PyArg_ParseTuple(args, stripformat[striptype], &sep)) return NULL; if (sep != NULL && sep != Py_None) { diff -r 4d5143ff58ea Objects/exceptions.c --- a/Objects/exceptions.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/exceptions.c Mon Oct 14 23:36:08 2013 +0300 @@ -121,11 +121,11 @@ static PyObject * BaseException_repr(PyBaseExceptionObject *self) { - char *name; - char *dot; + const char *name; + const char *dot; - name = (char *)Py_TYPE(self)->tp_name; - dot = strrchr(name, '.'); + name = Py_TYPE(self)->tp_name; + dot = (const char *) strrchr(name, '.'); if (dot != NULL) name = dot+1; return PyUnicode_FromFormat("%s%R", name, self->args); diff -r 4d5143ff58ea Objects/fileobject.c --- a/Objects/fileobject.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/fileobject.c Mon Oct 14 23:36:08 2013 +0300 @@ -26,8 +26,8 @@ /* External C interface */ PyObject * -PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding, - char *errors, char *newline, int closefd) +PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding, + const char *errors, const char *newline, int closefd) { PyObject *io, *stream; _Py_IDENTIFIER(open); diff -r 4d5143ff58ea Objects/longobject.c --- a/Objects/longobject.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/longobject.c Mon Oct 14 23:36:08 2013 +0300 @@ -1941,10 +1941,10 @@ * string characters. */ static PyLongObject * -long_from_binary_base(char **str, int base) +long_from_binary_base(const char **str, int base) { - char *p = *str; - char *start = p; + const char *p = *str; + const char *start = p; int bits_per_char; Py_ssize_t n; PyLongObject *z; @@ -2009,10 +2009,10 @@ * If unsuccessful, NULL will be returned. */ PyObject * -PyLong_FromString(char *str, char **pend, int base) +PyLong_FromString(const char *str, char **pend, int base) { int sign = 1, error_if_nonzero = 0; - char *start, *orig_str = str; + const char *start, *orig_str = str; PyLongObject *z = NULL; PyObject *strobj; Py_ssize_t slen; @@ -2147,7 +2147,7 @@ int convwidth; twodigits convmultmax, convmult; digit *pz, *pzstop; - char* scan; + const char* scan; static double log_base_BASE[37] = {0.0e0,}; static int convwidth_base[37] = {0,}; @@ -2275,12 +2275,12 @@ if (z == NULL) return NULL; if (pend != NULL) - *pend = str; + *pend = (char *)str; return (PyObject *) z; onError: if (pend != NULL) - *pend = str; + *pend = (char *)str; Py_XDECREF(z); slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; strobj = PyUnicode_FromStringAndSize(orig_str, slen); diff -r 4d5143ff58ea Objects/unicodeobject.c --- a/Objects/unicodeobject.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Objects/unicodeobject.c Mon Oct 14 23:36:08 2013 +0300 @@ -11872,7 +11872,7 @@ { PyObject *sep = NULL; - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) + if (!PyArg_ParseTuple(args, stripformat[striptype], &sep)) return NULL; if (sep != NULL && sep != Py_None) { diff -r 4d5143ff58ea Parser/grammar.c --- a/Parser/grammar.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/grammar.c Mon Oct 14 23:36:08 2013 +0300 @@ -29,7 +29,7 @@ } dfa * -adddfa(grammar *g, int type, char *name) +adddfa(grammar *g, int type, const char *name) { dfa *d; @@ -85,7 +85,7 @@ } int -addlabel(labellist *ll, int type, char *str) +addlabel(labellist *ll, int type, const char *str) { int i; label *lb; @@ -111,7 +111,7 @@ /* Same, but rather dies than adds */ int -findlabel(labellist *ll, int type, char *str) +findlabel(labellist *ll, int type, const char *str) { int i; diff -r 4d5143ff58ea Parser/myreadline.c --- a/Parser/myreadline.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/myreadline.c Mon Oct 14 23:36:08 2013 +0300 @@ -109,7 +109,7 @@ /* Readline implementation using fgets() */ char * -PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) +PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) { size_t n; char *p, *pr; @@ -170,13 +170,13 @@ Note: Python expects in return a buffer allocated with PyMem_Malloc. */ -char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); +char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); /* Interface used by tokenizer.c and bltinmodule.c */ char * -PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) +PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) { char *rv, *res; size_t len; diff -r 4d5143ff58ea Parser/parser.c --- a/Parser/parser.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/parser.c Mon Oct 14 23:36:08 2013 +0300 @@ -134,13 +134,13 @@ /* PARSER PROPER */ static int -classify(parser_state *ps, int type, char *str) +classify(parser_state *ps, int type, const char *str) { grammar *g = ps->p_grammar; int n = g->g_ll.ll_nlabels; if (type == NAME) { - char *s = str; + const char *s = str; label *l = g->g_ll.ll_label; int i; for (i = n; i > 0; i--, l++) { diff -r 4d5143ff58ea Parser/parsetok.c --- a/Parser/parsetok.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/parsetok.c Mon Oct 14 23:36:08 2013 +0300 @@ -94,7 +94,8 @@ node * PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret) + const char *ps1, const char *ps2, + perrdetail *err_ret) { return PyParser_ParseFileFlags(fp, filename, NULL, g, start, ps1, ps2, err_ret, 0); @@ -103,7 +104,8 @@ node * PyParser_ParseFileFlags(FILE *fp, const char *filename, const char *enc, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret, int flags) + const char *ps1, const char *ps2, + perrdetail *err_ret, int flags) { int iflags = flags; return PyParser_ParseFileFlagsEx(fp, filename, enc, g, start, ps1, @@ -113,15 +115,15 @@ node * PyParser_ParseFileObject(FILE *fp, PyObject *filename, const char *enc, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret, - int *flags) + const char *ps1, const char *ps2, + perrdetail *err_ret, int *flags) { struct tok_state *tok; if (initerr(err_ret, filename) < 0) return NULL; - if ((tok = PyTokenizer_FromFile(fp, (char *)enc, ps1, ps2)) == NULL) { + if ((tok = PyTokenizer_FromFile(fp, enc, ps1, ps2)) == NULL) { err_ret->error = E_NOMEM; return NULL; } @@ -135,7 +137,8 @@ node * PyParser_ParseFileFlagsEx(FILE *fp, const char *filename, const char *enc, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret, int *flags) + const char *ps1, const char *ps2, + perrdetail *err_ret, int *flags) { node *n; PyObject *fileobj = NULL; diff -r 4d5143ff58ea Parser/pgenmain.c --- a/Parser/pgenmain.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/pgenmain.c Mon Oct 14 23:36:08 2013 +0300 @@ -138,7 +138,7 @@ /* No-nonsense my_readline() for tokenizer.c */ char * -PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) +PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) { size_t n = 1000; char *p = (char *)PyMem_MALLOC(n); diff -r 4d5143ff58ea Parser/tokenizer.c --- a/Parser/tokenizer.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/tokenizer.c Mon Oct 14 23:36:08 2013 +0300 @@ -31,7 +31,7 @@ || c == '_'\ || (c >= 128)) -extern char *PyOS_Readline(FILE *, FILE *, char *); +extern char *PyOS_Readline(FILE *, FILE *, const char *); /* Return malloc'ed string including trailing \n; empty malloc'ed string for EOF; NULL if interrupted */ @@ -780,7 +780,7 @@ struct tok_state *tok = tok_new(); if (tok == NULL) return NULL; - str = (char *)decode_str(str, exec_input, tok); + str = decode_str(str, exec_input, tok); if (str == NULL) { PyTokenizer_Free(tok); return NULL; @@ -823,7 +823,8 @@ /* Set up tokenizer for file */ struct tok_state * -PyTokenizer_FromFile(FILE *fp, char* enc, char *ps1, char *ps2) +PyTokenizer_FromFile(FILE *fp, const char* enc, + const char *ps1, const char *ps2) { struct tok_state *tok = tok_new(); if (tok == NULL) diff -r 4d5143ff58ea Parser/tokenizer.h --- a/Parser/tokenizer.h Mon Oct 14 21:19:24 2013 +0300 +++ b/Parser/tokenizer.h Mon Oct 14 23:36:08 2013 +0300 @@ -35,7 +35,7 @@ int indstack[MAXINDENT]; /* Stack of indents */ int atbol; /* Nonzero if at begin of new line */ int pendin; /* Pending indents (if > 0) or dedents (if < 0) */ - char *prompt, *nextprompt; /* For interactive prompting */ + const char *prompt, *nextprompt; /* For interactive prompting */ int lineno; /* Current line number */ int level; /* () [] {} Parentheses nesting level */ /* Used to allow free continuations inside them */ @@ -69,8 +69,8 @@ extern struct tok_state *PyTokenizer_FromString(const char *, int); extern struct tok_state *PyTokenizer_FromUTF8(const char *, int); -extern struct tok_state *PyTokenizer_FromFile(FILE *, char*, - char *, char *); +extern struct tok_state *PyTokenizer_FromFile(FILE *, const char*, + const char *, const char *); extern void PyTokenizer_Free(struct tok_state *); extern int PyTokenizer_Get(struct tok_state *, char **, char **); extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok, diff -r 4d5143ff58ea Python/ast.c --- a/Python/ast.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/ast.c Mon Oct 14 23:36:08 2013 +0300 @@ -3651,18 +3651,16 @@ end = s + strlen(s) - 1; imflag = *end == 'j' || *end == 'J'; if (s[0] == '0') { - x = (long) PyOS_strtoul((char *)s, (char **)&end, 0); + x = (long) PyOS_strtoul(s, (char **)&end, 0); if (x < 0 && errno == 0) { - return PyLong_FromString((char *)s, - (char **)0, - 0); + return PyLong_FromString(s, (char **)0, 0); } } else - x = PyOS_strtol((char *)s, (char **)&end, 0); + x = PyOS_strtol(s, (char **)&end, 0); if (*end == '\0') { if (errno != 0) - return PyLong_FromString((char *)s, (char **)0, 0); + return PyLong_FromString(s, (char **)0, 0); return PyLong_FromLong(x); } /* XXX Huge floats may silently fail */ @@ -3685,8 +3683,8 @@ static PyObject * decode_utf8(struct compiling *c, const char **sPtr, const char *end) { - char *s, *t; - t = s = (char *)*sPtr; + const char *s, *t; + t = s = *sPtr; /* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */ while (s < end && (*s & 0x80)) s++; *sPtr = s; diff -r 4d5143ff58ea Python/bltinmodule.c --- a/Python/bltinmodule.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/bltinmodule.c Mon Oct 14 23:36:08 2013 +0300 @@ -1335,7 +1335,7 @@ if (positional) v = args; - else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v)) + else if (!PyArg_UnpackTuple(args, name, 1, 1, &v)) return NULL; emptytuple = PyTuple_New(0); diff -r 4d5143ff58ea Python/codecs.c --- a/Python/codecs.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/codecs.c Mon Oct 14 23:36:08 2013 +0300 @@ -441,7 +441,7 @@ return -1; } return PyDict_SetItemString(interp->codec_error_registry, - (char *)name, error); + name, error); } /* Lookup the error handling callback function registered under the @@ -457,7 +457,7 @@ if (name==NULL) name = "strict"; - handler = PyDict_GetItemString(interp->codec_error_registry, (char *)name); + handler = PyDict_GetItemString(interp->codec_error_registry, name); if (!handler) PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name); else diff -r 4d5143ff58ea Python/import.c --- a/Python/import.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/import.c Mon Oct 14 23:36:08 2013 +0300 @@ -517,7 +517,7 @@ } int -_PyImport_FixupBuiltin(PyObject *mod, char *name) +_PyImport_FixupBuiltin(PyObject *mod, const char *name) { int res; PyObject *nameobj; @@ -656,22 +656,23 @@ * interface. The other two exist primarily for backward compatibility. */ PyObject * -PyImport_ExecCodeModule(char *name, PyObject *co) +PyImport_ExecCodeModule(const char *name, PyObject *co) { return PyImport_ExecCodeModuleWithPathnames( name, co, (char *)NULL, (char *)NULL); } PyObject * -PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) +PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname) { return PyImport_ExecCodeModuleWithPathnames( name, co, pathname, (char *)NULL); } PyObject * -PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, - char *cpathname) +PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, + const char *pathname, + const char *cpathname) { PyObject *m = NULL; PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL; @@ -1019,7 +1020,7 @@ size = p->size; if (size < 0) size = -size; - return PyMarshal_ReadObjectFromString((char *)p->code, size); + return PyMarshal_ReadObjectFromString((const char *)p->code, size); } static PyObject * @@ -1071,7 +1072,7 @@ ispackage = (size < 0); if (ispackage) size = -size; - co = PyMarshal_ReadObjectFromString((char *)p->code, size); + co = PyMarshal_ReadObjectFromString((const char *)p->code, size); if (co == NULL) return -1; if (!PyCode_Check(co)) { @@ -1113,7 +1114,7 @@ } int -PyImport_ImportFrozenModule(char *name) +PyImport_ImportFrozenModule(const char *name) { PyObject *nameobj; int ret; diff -r 4d5143ff58ea Python/marshal.c --- a/Python/marshal.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/marshal.c Mon Oct 14 23:36:08 2013 +0300 @@ -1468,15 +1468,15 @@ } PyObject * -PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len) +PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len) { RFILE rf; PyObject *result; rf.fp = NULL; rf.readable = NULL; rf.current_filename = NULL; - rf.ptr = str; - rf.end = str + len; + rf.ptr = (char *)str; + rf.end = (char *)str + len; rf.buf = NULL; rf.depth = 0; rf.refs = PyList_New(0); diff -r 4d5143ff58ea Python/mystrtoul.c --- a/Python/mystrtoul.c Mon Oct 14 21:19:24 2013 +0300 +++ b/Python/mystrtoul.c Mon Oct 14 23:36:08 2013 +0300 @@ -92,7 +92,7 @@ ** exceptions - we don't check for them. */ unsigned long -PyOS_strtoul(char *str, char **ptr, int base) +PyOS_strtoul(const char *str, char **ptr, int base) { unsigned long result = 0; /* return value of the function */ int c; /* current input character */ @@ -111,7 +111,7 @@ /* there must be at least one digit after 0x */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -120,7 +120,7 @@ /* there must be at least one digit after 0o */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -129,7 +129,7 @@ /* there must be at least one digit after 0b */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -141,7 +141,7 @@ while (Py_ISSPACE(Py_CHARMASK(*str))) ++str; if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } } @@ -157,7 +157,7 @@ /* there must be at least one digit after 0x */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -171,7 +171,7 @@ /* there must be at least one digit after 0o */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -185,7 +185,7 @@ /* there must be at least one digit after 0b */ if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } ++str; @@ -197,7 +197,7 @@ /* catch silly bases */ if (base < 2 || base > 36) { if (ptr) - *ptr = str; + *ptr = (char *)str; return 0; } @@ -239,7 +239,7 @@ /* set pointer to point to the last character scanned */ if (ptr) - *ptr = str; + *ptr = (char *)str; return result; @@ -248,7 +248,7 @@ /* spool through remaining digit characters */ while (_PyLong_DigitValue[Py_CHARMASK(*str)] < base) ++str; - *ptr = str; + *ptr = (char *)str; } errno = ERANGE; return (unsigned long)-1; @@ -260,7 +260,7 @@ #define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) long -PyOS_strtol(char *str, char **ptr, int base) +PyOS_strtol(const char *str, char **ptr, int base) { long result; unsigned long uresult;