diff -r 35da9e3ba697 Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/dict.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/c-api/file.rst --- a/Doc/c-api/file.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/file.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/c-api/import.rst --- a/Doc/c-api/import.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/import.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/c-api/long.rst --- a/Doc/c-api/long.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/long.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/c-api/mapping.rst --- a/Doc/c-api/mapping.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/mapping.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/c-api/veryhigh.rst --- a/Doc/c-api/veryhigh.rst Fri May 31 22:18:26 2013 -0700 +++ b/Doc/c-api/veryhigh.rst Sat Jun 01 16:12:59 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 35da9e3ba697 Doc/data/refcounts.dat --- a/Doc/data/refcounts.dat Fri May 31 22:18:26 2013 -0700 +++ b/Doc/data/refcounts.dat Sat Jun 01 16:12:59 2013 +0300 @@ -210,7 +210,7 @@ PyDict_DelItemString:int::: PyDict_DelItemString:PyObject*:p:0: -PyDict_DelItemString:char*:key:: +PyDict_DelItemString:const char*:key:: PyDict_GetItem:PyObject*::0:0 PyDict_GetItem:PyObject*:p:0: @@ -249,7 +249,7 @@ PyDict_SetItemString:int::: PyDict_SetItemString:PyObject*:p:0: -PyDict_SetItemString:char*:key:: +PyDict_SetItemString:const char*:key:: PyDict_SetItemString:PyObject*:val:+1: PyDict_Size:int::: @@ -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: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:: @@ -697,11 +697,11 @@ PyMapping_DelItemString:int::: PyMapping_DelItemString:PyObject*:o:0: -PyMapping_DelItemString:char*:key:: +PyMapping_DelItemString:const char*:key:: 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: @@ -954,7 +954,7 @@ PyObject_DelAttrString:int::: PyObject_DelAttrString:PyObject*:o:0: -PyObject_DelAttrString:char*:attr_name:: +PyObject_DelAttrString:const char*:attr_name:: PyObject_DelItem:int::: PyObject_DelItem:PyObject*:o:0: @@ -969,7 +969,7 @@ PyObject_GetAttrString:PyObject*::+1: PyObject_GetAttrString:PyObject*:o:0: -PyObject_GetAttrString:char*:attr_name:: +PyObject_GetAttrString:const char*:attr_name:: PyObject_GetItem:PyObject*::+1: PyObject_GetItem:PyObject*:o:0: @@ -984,7 +984,7 @@ PyObject_HasAttrString:int::: PyObject_HasAttrString:PyObject*:o:0: -PyObject_HasAttrString:char*:attr_name:0: +PyObject_HasAttrString:const char*:attr_name:0: PyObject_Hash:int::: PyObject_Hash:PyObject*:o:0: @@ -1034,7 +1034,7 @@ PyObject_SetAttrString:int::: PyObject_SetAttrString:PyObject*:o:0: -PyObject_SetAttrString:char*:attr_name:: +PyObject_SetAttrString:const char*:attr_name:: PyObject_SetAttrString:PyObject*:v:+1: PyObject_SetItem:int::: diff -r 35da9e3ba697 Include/abstract.h --- a/Include/abstract.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/abstract.h Sat Jun 01 16:12:59 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 35da9e3ba697 Include/fileobject.h --- a/Include/fileobject.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/fileobject.h Sat Jun 01 16:12:59 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 35da9e3ba697 Include/grammar.h --- a/Include/grammar.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/grammar.h Sat Jun 01 16:12:59 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 35da9e3ba697 Include/import.h --- a/Include/import.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/import.h Sat Jun 01 16:12:59 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 35da9e3ba697 Include/longobject.h --- a/Include/longobject.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/longobject.h Sat Jun 01 16:12:59 2013 +0300 @@ -80,7 +80,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); @@ -175,8 +175,8 @@ /* These aren't really part of the long 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 35da9e3ba697 Include/marshal.h --- a/Include/marshal.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/marshal.h Sat Jun 01 16:12:59 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 35da9e3ba697 Include/parsetok.h --- a/Include/parsetok.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/parsetok.h Sat Jun 01 16:12:59 2013 +0300 @@ -38,22 +38,23 @@ 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); PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, - const char*, grammar *, - int, char *, char *, - perrdetail *, int); + const char*, grammar *, int, + const char *, const char *, + perrdetail *, int); PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ const char *enc, grammar *g, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, perrdetail *err_ret, int *flags); diff -r 35da9e3ba697 Include/pyport.h --- a/Include/pyport.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/pyport.h Sat Jun 01 16:12:59 2013 +0300 @@ -668,8 +668,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 35da9e3ba697 Include/pythonrun.h --- a/Include/pythonrun.h Fri May 31 22:18:26 2013 -0700 +++ b/Include/pythonrun.h Sat Jun 01 16:12:59 2013 +0300 @@ -227,10 +227,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 35da9e3ba697 Modules/_sqlite/statement.c --- a/Modules/_sqlite/statement.c Fri May 31 22:18:26 2013 -0700 +++ b/Modules/_sqlite/statement.c Sat Jun 01 16:12:59 2013 +0300 @@ -249,7 +249,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 35da9e3ba697 Modules/cjkcodecs/cjkcodecs.h --- a/Modules/cjkcodecs/cjkcodecs.h Fri May 31 22:18:26 2013 -0700 +++ b/Modules/cjkcodecs/cjkcodecs.h Sat Jun 01 16:12:59 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 35da9e3ba697 Modules/readline.c --- a/Modules/readline.c Fri May 31 22:18:26 2013 -0700 +++ b/Modules/readline.c Sat Jun 01 16:12:59 2013 +0300 @@ -964,7 +964,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; @@ -1066,7 +1066,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 35da9e3ba697 Objects/abstract.c --- a/Objects/abstract.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/abstract.c Sat Jun 01 16:12:59 2013 +0300 @@ -223,7 +223,7 @@ } int -PyObject_DelItemString(PyObject *o, char *key) +PyObject_DelItemString(PyObject *o, const char *key) { PyObject *okey; int ret; @@ -1268,7 +1268,7 @@ char *end; PyObject *x; - x = PyLong_FromString((char*)s, &end, 10); + x = PyLong_FromString(s, &end, 10); if (x == NULL) return NULL; if (end != s + len) { @@ -1970,7 +1970,7 @@ #define PyMapping_Length PyMapping_Size PyObject * -PyMapping_GetItemString(PyObject *o, char *key) +PyMapping_GetItemString(PyObject *o, const char *key) { PyObject *okey, *r; @@ -1986,7 +1986,7 @@ } int -PyMapping_SetItemString(PyObject *o, char *key, PyObject *value) +PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value) { PyObject *okey; int r; @@ -2005,7 +2005,7 @@ } int -PyMapping_HasKeyString(PyObject *o, char *key) +PyMapping_HasKeyString(PyObject *o, const char *key) { PyObject *v; diff -r 35da9e3ba697 Objects/bytesobject.c --- a/Objects/bytesobject.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/bytesobject.c Sat Jun 01 16:12:59 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 35da9e3ba697 Objects/exceptions.c --- a/Objects/exceptions.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/exceptions.c Sat Jun 01 16:12:59 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 35da9e3ba697 Objects/fileobject.c --- a/Objects/fileobject.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/fileobject.c Sat Jun 01 16:12:59 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 35da9e3ba697 Objects/longobject.c --- a/Objects/longobject.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/longobject.c Sat Jun 01 16:12:59 2013 +0300 @@ -1935,10 +1935,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; @@ -1995,10 +1995,10 @@ } 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; @@ -2133,7 +2133,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,}; @@ -2257,7 +2257,7 @@ if (*str != '\0') goto onError; if (pend) - *pend = str; + *pend = (char *)str; long_normalize(z); return (PyObject *) maybe_small_long(z); diff -r 35da9e3ba697 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Fri May 31 22:18:26 2013 -0700 +++ b/Objects/unicodeobject.c Sat Jun 01 16:12:59 2013 +0300 @@ -11867,7 +11867,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 35da9e3ba697 Parser/grammar.c --- a/Parser/grammar.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/grammar.c Sat Jun 01 16:12:59 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 35da9e3ba697 Parser/myreadline.c --- a/Parser/myreadline.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/myreadline.c Sat Jun 01 16:12:59 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; @@ -154,13 +154,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; diff -r 35da9e3ba697 Parser/parser.c --- a/Parser/parser.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/parser.c Sat Jun 01 16:12:59 2013 +0300 @@ -105,7 +105,8 @@ /* PARSER STACK OPERATIONS */ static int -shift(register stack *s, int type, char *str, int newstate, int lineno, int col_offset) +shift(register stack *s, int type, char *str, int newstate, + int lineno, int col_offset) { int err; assert(!s_empty(s)); @@ -134,13 +135,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; register int n = g->g_ll.ll_nlabels; if (type == NAME) { - register char *s = str; + register const char *s = str; register label *l = g->g_ll.ll_label; register int i; for (i = n; i > 0; i--, l++) { diff -r 35da9e3ba697 Parser/parsetok.c --- a/Parser/parsetok.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/parsetok.c Sat Jun 01 16:12:59 2013 +0300 @@ -71,7 +71,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); @@ -80,7 +81,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, @@ -90,14 +92,15 @@ 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) { 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; } diff -r 35da9e3ba697 Parser/pgenmain.c --- a/Parser/pgenmain.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/pgenmain.c Sat Jun 01 16:12:59 2013 +0300 @@ -137,7 +137,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 35da9e3ba697 Parser/tokenizer.c --- a/Parser/tokenizer.c Fri May 31 22:18:26 2013 -0700 +++ b/Parser/tokenizer.c Sat Jun 01 16:12:59 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 */ @@ -768,7 +768,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; @@ -811,7 +811,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 35da9e3ba697 Parser/tokenizer.h --- a/Parser/tokenizer.h Fri May 31 22:18:26 2013 -0700 +++ b/Parser/tokenizer.h Sat Jun 01 16:12:59 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 35da9e3ba697 Python/ast.c --- a/Python/ast.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/ast.c Sat Jun 01 16:12:59 2013 +0300 @@ -3631,18 +3631,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 */ @@ -3665,8 +3663,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 35da9e3ba697 Python/bltinmodule.c --- a/Python/bltinmodule.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/bltinmodule.c Sat Jun 01 16:12:59 2013 +0300 @@ -1333,7 +1333,7 @@ if (PyTuple_Size(args) > 1) v = args; - else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v)) + else if (!PyArg_UnpackTuple(args, name, 1, 1, &v)) return NULL; if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds)) { diff -r 35da9e3ba697 Python/codecs.c --- a/Python/codecs.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/codecs.c Sat Jun 01 16:12:59 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 35da9e3ba697 Python/import.c --- a/Python/import.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/import.c Sat Jun 01 16:12:59 2013 +0300 @@ -546,7 +546,7 @@ } int -_PyImport_FixupBuiltin(PyObject *mod, char *name) +_PyImport_FixupBuiltin(PyObject *mod, const char *name) { int res; PyObject *nameobj; @@ -682,22 +682,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; @@ -1045,7 +1046,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 * @@ -1097,7 +1098,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)) { @@ -1139,7 +1140,7 @@ } int -PyImport_ImportFrozenModule(char *name) +PyImport_ImportFrozenModule(const char *name) { PyObject *nameobj; int ret; diff -r 35da9e3ba697 Python/marshal.c --- a/Python/marshal.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/marshal.c Sat Jun 01 16:12:59 2013 +0300 @@ -97,7 +97,7 @@ } static void -w_string(char *s, Py_ssize_t n, WFILE *p) +w_string(const char *s, Py_ssize_t n, WFILE *p) { if (p->fp != NULL) { fwrite(s, 1, n, p->fp); @@ -1375,15 +1375,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.depth = 0; rf.refs = PyList_New(0); if (rf.refs == NULL) diff -r 35da9e3ba697 Python/mystrtoul.c --- a/Python/mystrtoul.c Fri May 31 22:18:26 2013 -0700 +++ b/Python/mystrtoul.c Sat Jun 01 16:12:59 2013 +0300 @@ -92,7 +92,7 @@ ** exceptions - we don't check for them. */ unsigned long -PyOS_strtoul(register char *str, char **ptr, int base) +PyOS_strtoul(register const char *str, char **ptr, int base) { register unsigned long result = 0; /* return value of the function */ register 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;