diff -r af0b95fb1c19 Include/bytes_methods.h --- a/Include/bytes_methods.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Include/bytes_methods.h Mon Dec 21 10:49:49 2015 +0200 @@ -17,9 +17,9 @@ extern PyObject* _Py_bytes_istitle(const /* These store their len sized answer in the given preallocated *result arg. */ extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); -extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); +extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len); +extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len); /* The maketrans() static method. */ extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to); diff -r af0b95fb1c19 Include/object.h --- a/Include/object.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Include/object.h Mon Dec 21 10:49:49 2015 +0200 @@ -322,9 +322,9 @@ typedef void (*destructor)(PyObject *); should at least cause a warning in most cases. */ typedef int (*printfunc)(PyObject *, FILE *, int); #endif -typedef PyObject *(*getattrfunc)(PyObject *, char *); +typedef PyObject *(*getattrfunc)(PyObject *, const char *); typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); -typedef int (*setattrfunc)(PyObject *, char *, PyObject *); +typedef int (*setattrfunc)(PyObject *, const char *, PyObject *); typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); typedef PyObject *(*reprfunc)(PyObject *); typedef Py_hash_t (*hashfunc)(PyObject *); diff -r af0b95fb1c19 Include/py_curses.h --- a/Include/py_curses.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Include/py_curses.h Mon Dec 21 10:49:49 2015 +0200 @@ -103,8 +103,8 @@ static void **PyCurses_API; #endif /* general error messages */ -static char *catchall_ERR = "curses function returned ERR"; -static char *catchall_NULL = "curses function returned NULL"; +static const char *catchall_ERR = "curses function returned ERR"; +static const char *catchall_NULL = "curses function returned NULL"; /* Function Prototype Macros - They are ugly but very, very useful. ;-) diff -r af0b95fb1c19 Include/pythonrun.h --- a/Include/pythonrun.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Include/pythonrun.h Mon Dec 21 10:49:49 2015 +0200 @@ -66,8 +66,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFr const char *filename, /* decoded from the filesystem encoding */ const char* enc, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); @@ -76,8 +76,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFr PyObject *filename, const char* enc, int start, - char *ps1, - char *ps2, + const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena); diff -r af0b95fb1c19 Misc/coverity_model.c --- a/Misc/coverity_model.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Misc/coverity_model.c Mon Dec 21 10:49:49 2015 +0200 @@ -94,7 +94,7 @@ wchar_t *Py_DecodeLocale(const char* arg } /* Parser/pgenmain.c */ -grammar *getgrammar(char *filename) +grammar *getgrammar(const char *filename) { grammar *g; __coverity_tainted_data_sink__(filename); diff -r af0b95fb1c19 Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_ctypes/_ctypes.c Mon Dec 21 10:49:49 2015 +0200 @@ -436,7 +436,7 @@ UnionType_new(PyTypeObject *type, PyObje return StructUnionType_new(type, args, kwds, 0); } -static char from_address_doc[] = +static const char from_address_doc[] = "C.from_address(integer) -> C instance\naccess a C instance at the specified address"; static PyObject * @@ -454,7 +454,7 @@ CDataType_from_address(PyObject *type, P return PyCData_AtAddress(type, buf); } -static char from_buffer_doc[] = +static const char from_buffer_doc[] = "C.from_buffer(object, offset=0) -> C instance\ncreate a C instance from a writeable buffer"; static int @@ -525,7 +525,7 @@ CDataType_from_buffer(PyObject *type, Py return result; } -static char from_buffer_copy_doc[] = +static const char from_buffer_copy_doc[] = "C.from_buffer_copy(object, offset=0) -> C instance\ncreate a C instance from a readable buffer"; static PyObject * @@ -567,7 +567,7 @@ CDataType_from_buffer_copy(PyObject *typ return result; } -static char in_dll_doc[] = +static const char in_dll_doc[] = "C.in_dll(dll, name) -> C instance\naccess a C instance in a dll"; static PyObject * @@ -624,7 +624,7 @@ CDataType_in_dll(PyObject *type, PyObjec return PyCData_AtAddress(type, address); } -static char from_param_doc[] = +static const char from_param_doc[] = "Convert a Python object into a function call parameter."; static PyObject * @@ -1485,7 +1485,7 @@ PyCSimpleType_new ensures that the new S */ -static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOv?g"; +static const char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOv?g"; static PyObject * c_wchar_p_from_param(PyObject *type, PyObject *value) @@ -3207,7 +3207,7 @@ static int } static int -_get_name(PyObject *obj, char **pname) +_get_name(PyObject *obj, const char **pname) { #ifdef MS_WIN32 if (PyLong_Check(obj)) { @@ -3235,7 +3235,7 @@ static int static PyObject * PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds) { - char *name; + const char *name; int (* address)(void); PyObject *ftuple; PyObject *dll; @@ -5130,7 +5130,7 @@ static const char module_docs[] = #ifdef MS_WIN32 -static char comerror_doc[] = "Raised when a COM method call failed."; +static const char comerror_doc[] = "Raised when a COM method call failed."; int comerror_init(PyObject *self, PyObject *args, PyObject *kwds) diff -r af0b95fb1c19 Modules/_ctypes/callbacks.c --- a/Modules/_ctypes/callbacks.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_ctypes/callbacks.c Mon Dec 21 10:49:49 2015 +0200 @@ -77,7 +77,7 @@ PyTypeObject PyCThunk_Type = { /**************************************************************/ static void -PrintError(char *msg, ...) +PrintError(const char *msg, ...) { char buf[512]; PyObject *f = PySys_GetObject("stderr"); diff -r af0b95fb1c19 Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_ctypes/callproc.c Mon Dec 21 10:49:49 2015 +0200 @@ -928,7 +928,7 @@ static PyObject *GetResult(PyObject *res * Raise a new exception 'exc_class', adding additional text to the original * exception string. */ -void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...) +void _ctypes_extend_error(PyObject *exc_class, const char *fmt, ...) { va_list vargs; PyObject *tp, *v, *tb, *s, *cls_str, *msg_str; @@ -1201,7 +1201,7 @@ static int #ifdef MS_WIN32 -static char format_error_doc[] = +static const char format_error_doc[] = "FormatError([integer]) -> string\n\ \n\ Convert a win32 error code into a string. If the error code is not\n\ @@ -1225,7 +1225,7 @@ static PyObject *format_error(PyObject * return result; } -static char load_library_doc[] = +static const char load_library_doc[] = "LoadLibrary(name) -> handle\n\ \n\ Load an executable (usually a DLL), and return a handle to it.\n\ @@ -1254,7 +1254,7 @@ static PyObject *load_library(PyObject * #endif } -static char free_library_doc[] = +static const char free_library_doc[] = "FreeLibrary(handle) -> void\n\ \n\ Free the handle of an executable previously loaded by LoadLibrary.\n"; @@ -1269,7 +1269,7 @@ static PyObject *free_library(PyObject * return Py_None; } -static char copy_com_pointer_doc[] = +static const char copy_com_pointer_doc[] = "CopyComPointer(src, dst) -> HRESULT value\n"; static PyObject * @@ -1439,7 +1439,7 @@ call_cdeclfunction(PyObject *self, PyObj /***************************************************************** * functions */ -static char sizeof_doc[] = +static const char sizeof_doc[] = "sizeof(C type) -> integer\n" "sizeof(C instance) -> integer\n" "Return the size in bytes of a C instance"; @@ -1460,7 +1460,7 @@ sizeof_func(PyObject *self, PyObject *ob return NULL; } -static char alignment_doc[] = +static const char alignment_doc[] = "alignment(C type) -> integer\n" "alignment(C instance) -> integer\n" "Return the alignment requirements of a C instance"; @@ -1483,7 +1483,7 @@ align_func(PyObject *self, PyObject *obj return NULL; } -static char byref_doc[] = +static const char byref_doc[] = "byref(C instance[, offset=0]) -> byref-object\n" "Return a pointer lookalike to a C instance, only usable\n" "as function argument"; @@ -1527,7 +1527,7 @@ byref(PyObject *self, PyObject *args) return (PyObject *)parg; } -static char addressof_doc[] = +static const char addressof_doc[] = "addressof(C instance) -> integer\n" "Return the address of the C instance internal buffer"; diff -r af0b95fb1c19 Modules/_ctypes/ctypes.h --- a/Modules/_ctypes/ctypes.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_ctypes/ctypes.h Mon Dec 21 10:49:49 2015 +0200 @@ -327,7 +327,7 @@ extern int PyCData_set(PyObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value, Py_ssize_t index, Py_ssize_t size, char *ptr); -extern void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...); +extern void _ctypes_extend_error(PyObject *exc_class, const char *fmt, ...); struct basespec { CDataObject *base; diff -r af0b95fb1c19 Modules/_curses_panel.c --- a/Modules/_curses_panel.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_curses_panel.c Mon Dec 21 10:49:49 2015 +0200 @@ -6,7 +6,7 @@ /* Release Number */ -static char *PyCursesVersion = "2.1"; +static const char *PyCursesVersion = "2.1"; /* Includes */ @@ -56,7 +56,7 @@ static struct PyModuleDef _curses_panelm */ static PyObject * -PyCursesCheckERR(int code, char *fname) +PyCursesCheckERR(int code, const char *fname) { if (code != ERR) { Py_INCREF(Py_None); diff -r af0b95fb1c19 Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_datetimemodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -873,7 +873,7 @@ get_tzinfo_member(PyObject *self) * this returns NULL. Else result is returned. */ static PyObject * -call_tzinfo_method(PyObject *tzinfo, char *name, PyObject *tzinfoarg) +call_tzinfo_method(PyObject *tzinfo, const char *name, PyObject *tzinfoarg) { PyObject *offset; @@ -2307,7 +2307,7 @@ static PyMethodDef delta_methods[] = { {NULL, NULL}, }; -static char delta_doc[] = +static const char delta_doc[] = PyDoc_STR("Difference between two datetime values."); static PyNumberMethods delta_as_number = { @@ -2886,7 +2886,7 @@ static PyMethodDef date_methods[] = { {NULL, NULL} }; -static char date_doc[] = +static const char date_doc[] = PyDoc_STR("date(year, month, day) --> date object"); static PyNumberMethods date_as_number = { @@ -3877,7 +3877,7 @@ static PyMethodDef time_methods[] = { {NULL, NULL} }; -static char time_doc[] = +static const char time_doc[] = PyDoc_STR("time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object\n\ \n\ All arguments are optional. tzinfo may be None, or an instance of\n\ @@ -5065,7 +5065,7 @@ static PyMethodDef datetime_methods[] = {NULL, NULL} }; -static char datetime_doc[] = +static const char datetime_doc[] = PyDoc_STR("datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\ \n\ The year, month and day arguments are required. tzinfo may be None, or an\n\ diff -r af0b95fb1c19 Modules/_dbmmodule.c --- a/Modules/_dbmmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_dbmmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -14,16 +14,16 @@ */ #if defined(HAVE_NDBM_H) #include -static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */ +static const char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */ #elif defined(HAVE_GDBM_NDBM_H) #include -static char *which_dbm = "GNU gdbm"; +static const char *which_dbm = "GNU gdbm"; #elif defined(HAVE_GDBM_DASH_NDBM_H) #include -static char *which_dbm = "GNU gdbm"; +static const char *which_dbm = "GNU gdbm"; #elif defined(HAVE_BERKDB_H) #include -static char *which_dbm = "Berkeley DB"; +static const char *which_dbm = "Berkeley DB"; #else #error "No ndbm.h available!" #endif diff -r af0b95fb1c19 Modules/_io/_iomodule.h --- a/Modules/_io/_iomodule.h Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_io/_iomodule.h Mon Dec 21 10:49:49 2015 +0200 @@ -60,7 +60,7 @@ extern PyObject *_PyIncrementalNewlineDe * Otherwise, the line ending is specified by readnl, a str object */ extern Py_ssize_t _PyIO_find_line_ending( int translated, int universal, PyObject *readnl, - int kind, char *start, char *end, Py_ssize_t *consumed); + int kind, const char *start, const char *end, Py_ssize_t *consumed); /* Return 1 if an EnvironmentError with errno == EINTR is set (and then clears the error indicator), 0 otherwise. diff -r af0b95fb1c19 Modules/_io/bufferedio.c --- a/Modules/_io/bufferedio.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_io/bufferedio.c Mon Dec 21 10:49:49 2015 +0200 @@ -659,7 +659,7 @@ static Py_ssize_t /* Sets the current error to BlockingIOError */ static void -_set_BlockingIOError(char *msg, Py_ssize_t written) +_set_BlockingIOError(const char *msg, Py_ssize_t written) { PyObject *err; PyErr_Clear(); diff -r af0b95fb1c19 Modules/_io/fileio.c --- a/Modules/_io/fileio.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_io/fileio.c Mon Dec 21 10:49:49 2015 +0200 @@ -540,7 +540,7 @@ err_closed(void) } static PyObject * -err_mode(char *action) +err_mode(const char *action) { _PyIO_State *state = IO_STATE(); if (state != NULL) @@ -1043,7 +1043,7 @@ static PyObject * } #endif /* HAVE_FTRUNCATE */ -static char * +static const char * mode_string(fileio *self) { if (self->created) { diff -r af0b95fb1c19 Modules/_io/textio.c --- a/Modules/_io/textio.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_io/textio.c Mon Dec 21 10:49:49 2015 +0200 @@ -1648,8 +1648,8 @@ static PyObject * /* NOTE: `end` must point to the real end of the Py_UCS4 storage, that is to the NUL character. Otherwise the function will produce incorrect results. */ -static char * -find_control_char(int kind, char *s, char *end, Py_UCS4 ch) +static const char * +find_control_char(int kind, const char *s, const char *end, Py_UCS4 ch) { if (kind == PyUnicode_1BYTE_KIND) { assert(ch < 256); @@ -1669,13 +1669,13 @@ find_control_char(int kind, char *s, cha Py_ssize_t _PyIO_find_line_ending( int translated, int universal, PyObject *readnl, - int kind, char *start, char *end, Py_ssize_t *consumed) + int kind, const char *start, const char *end, Py_ssize_t *consumed) { Py_ssize_t len = ((char*)end - (char*)start)/kind; if (translated) { /* Newlines are already translated, only search for \n */ - char *pos = find_control_char(kind, start, end, '\n'); + const char *pos = find_control_char(kind, start, end, '\n'); if (pos != NULL) return (pos - start)/kind + 1; else { @@ -1687,7 +1687,7 @@ Py_ssize_t /* Universal newline search. Find any of \r, \r\n, \n * The decoder ensures that \r\n are not split in two pieces */ - char *s = start; + const char *s = start; for (;;) { Py_UCS4 ch; /* Fast path for non-control chars. The loop always ends @@ -1717,21 +1717,21 @@ Py_ssize_t /* Assume that readnl is an ASCII character. */ assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND); if (readnl_len == 1) { - char *pos = find_control_char(kind, start, end, nl[0]); + const char *pos = find_control_char(kind, start, end, nl[0]); if (pos != NULL) return (pos - start)/kind + 1; *consumed = len; return -1; } else { - char *s = start; - char *e = end - (readnl_len - 1)*kind; - char *pos; + const char *s = start; + const char *e = end - (readnl_len - 1)*kind; + const char *pos; if (e < s) e = s; while (s < e) { Py_ssize_t i; - char *pos = find_control_char(kind, s, end, nl[0]); + const char *pos = find_control_char(kind, s, end, nl[0]); if (pos == NULL || pos >= e) break; for (i = 1; i < readnl_len; i++) { diff -r af0b95fb1c19 Modules/_json.c --- a/Modules/_json.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_json.c Mon Dec 21 10:49:49 2015 +0200 @@ -112,7 +112,7 @@ encoder_listencode_dict(PyEncoderObject static PyObject * _encoded_const(PyObject *obj); static void -raise_errmsg(char *msg, PyObject *s, Py_ssize_t end); +raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end); static PyObject * encoder_encode_string(PyEncoderObject *s, PyObject *obj); static PyObject * @@ -323,7 +323,7 @@ escape_unicode(PyObject *pystr) } static void -raise_errmsg(char *msg, PyObject *s, Py_ssize_t end) +raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end) { /* Use JSONDecodeError exception to raise a nice looking ValueError subclass */ static PyObject *JSONDecodeError = NULL; diff -r af0b95fb1c19 Modules/_localemodule.c --- a/Modules/_localemodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_localemodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -49,7 +49,7 @@ PyDoc_STRVAR(setlocale__doc__, /* the grouping is terminated by either 0 or CHAR_MAX */ static PyObject* -copy_grouping(char* s) +copy_grouping(const char* s) { int i; PyObject *result, *val = NULL; diff -r af0b95fb1c19 Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_posixsubprocess.c Mon Dec 21 10:49:49 2015 +0200 @@ -72,7 +72,7 @@ static int /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ static int -_pos_int_from_ascii(char *name) +_pos_int_from_ascii(const char *name) { int num = 0; while (*name >= '0' && *name <= '9') { diff -r af0b95fb1c19 Modules/_scproxy.c --- a/Modules/_scproxy.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_scproxy.c Mon Dec 21 10:49:49 2015 +0200 @@ -130,7 +130,7 @@ error: } static int -set_proxy(PyObject* proxies, char* proto, CFDictionaryRef proxyDict, +set_proxy(PyObject* proxies, const char* proto, CFDictionaryRef proxyDict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) { diff -r af0b95fb1c19 Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_sqlite/connection.c Mon Dec 21 10:49:49 2015 +0200 @@ -1625,7 +1625,7 @@ pysqlite_connection_exit(pysqlite_Connec Py_RETURN_FALSE; } -static char connection_doc[] = +static const char connection_doc[] = PyDoc_STR("SQLite database connection object."); static PyGetSetDef connection_getset[] = { diff -r af0b95fb1c19 Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_sqlite/cursor.c Mon Dec 21 10:49:49 2015 +0200 @@ -27,7 +27,7 @@ PyObject* pysqlite_cursor_iternext(pysqlite_Cursor* self); -static char* errmsg_fetch_across_rollback = "Cursor needed to be reset because of commit/rollback and can no longer be fetched from."; +static const char* errmsg_fetch_across_rollback = "Cursor needed to be reset because of commit/rollback and can no longer be fetched from."; static pysqlite_StatementKind detect_statement_type(const char* statement) { @@ -1053,7 +1053,7 @@ static struct PyMemberDef cursor_members {NULL} }; -static char cursor_doc[] = +static const char cursor_doc[] = PyDoc_STR("SQLite database cursor class."); PyTypeObject pysqlite_CursorType = { diff -r af0b95fb1c19 Modules/_sre.c --- a/Modules/_sre.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_sre.c Mon Dec 21 10:49:49 2015 +0200 @@ -35,7 +35,7 @@ * other compatibility work. */ -static char copyright[] = +static const char copyright[] = " SRE 2.2.2 Copyright (c) 1997-2002 by Secret Labs AB "; #define PY_SSIZE_T_CLEAN @@ -714,7 +714,7 @@ static PyObject * } static PyObject* -call(char* module, char* function, PyObject* args) +call(const char* module, const char* function, PyObject* args) { PyObject* name; PyObject* mod; diff -r af0b95fb1c19 Modules/_ssl.c --- a/Modules/_ssl.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_ssl.c Mon Dec 21 10:49:49 2015 +0200 @@ -378,7 +378,7 @@ fail: } static PyObject * -PySSL_SetError(PySSLSocket *obj, int ret, char *filename, int lineno) +PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) { PyObject *type = PySSLErrorObject; char *errstr = NULL; @@ -460,7 +460,7 @@ PySSL_SetError(PySSLSocket *obj, int ret } static PyObject * -_setSSLError (char *errstr, int errcode, char *filename, int lineno) { +_setSSLError (const char *errstr, int errcode, const char *filename, int lineno) { if (errstr == NULL) errcode = ERR_peek_last_error(); diff -r af0b95fb1c19 Modules/_struct.c --- a/Modules/_struct.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_struct.c Mon Dec 21 10:49:49 2015 +0200 @@ -1189,7 +1189,7 @@ static formatdef lilendian_table[] = { static const formatdef * -whichtable(char **pfmt) +whichtable(const char **pfmt) { const char *fmt = (*pfmt)++; /* May be backed out of later */ switch (*fmt) { @@ -1268,7 +1268,7 @@ prepare_s(PyStructObject *self) fmt = PyBytes_AS_STRING(self->s_format); - f = whichtable((char **)&fmt); + f = whichtable(&fmt); s = fmt; size = 0; @@ -1457,7 +1457,7 @@ s_dealloc(PyStructObject *s) } static PyObject * -s_unpack_internal(PyStructObject *soself, char *startfrom) { +s_unpack_internal(PyStructObject *soself, const char *startfrom) { formatcode *code; Py_ssize_t i = 0; PyObject *result = PyTuple_New(soself->s_len); diff -r af0b95fb1c19 Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_testcapimodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -887,7 +887,7 @@ static PyObject * getargs_keywords(PyObject *self, PyObject *args, PyObject *kwargs) { static char *keywords[] = {"arg1","arg2","arg3","arg4","arg5", NULL}; - static char *fmt="(ii)i|(i(ii))(iii)i"; + static const char *fmt="(ii)i|(i(ii))(iii)i"; int int_args[10]={-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, fmt, keywords, @@ -3769,7 +3769,7 @@ test_structmembers_new(PyTypeObject *typ "T_LONGLONG", "T_ULONGLONG", #endif NULL}; - static char *fmt = "|bbBhHiIlknfds#" + static const char *fmt = "|bbBhHiIlknfds#" #ifdef HAVE_LONG_LONG "LK" #endif diff -r af0b95fb1c19 Modules/_testmultiphase.c --- a/Modules/_testmultiphase.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_testmultiphase.c Mon Dec 21 10:49:49 2015 +0200 @@ -61,7 +61,7 @@ Example_getattro(ExampleObject *self, Py } static int -Example_setattr(ExampleObject *self, char *name, PyObject *v) +Example_setattr(ExampleObject *self, const char *name, PyObject *v) { if (self->x_attr == NULL) { self->x_attr = PyDict_New(); diff -r af0b95fb1c19 Modules/_tkinter.c --- a/Modules/_tkinter.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_tkinter.c Mon Dec 21 10:49:49 2015 +0200 @@ -841,7 +841,7 @@ PyTclObject_dealloc(PyTclObject *self) Py_DECREF(tp); } -static char* +static const char * PyTclObject_TclString(PyObject *self) { return Tcl_GetString(((PyTclObject*)self)->value); @@ -1726,7 +1726,7 @@ static int varname_converter(PyObject *in, void *_out) { char *s; - char **out = (char**)_out; + const char **out = (const char**)_out; if (PyBytes_Check(in)) { if (PyBytes_Size(in) > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "bytes object is too long"); @@ -1846,7 +1846,7 @@ var_invoke(EventFunc func, PyObject *sel static PyObject * SetVar(PyObject *self, PyObject *args, int flags) { - char *name1, *name2; + const char *name1, *name2; PyObject *newValue; PyObject *res = NULL; Tcl_Obj *newval, *ok; @@ -1915,7 +1915,7 @@ Tkapp_GlobalSetVar(PyObject *self, PyObj static PyObject * GetVar(PyObject *self, PyObject *args, int flags) { - char *name1, *name2=NULL; + const char *name1, *name2=NULL; PyObject *res = NULL; Tcl_Obj *tres; diff -r af0b95fb1c19 Modules/_winapi.c --- a/Modules/_winapi.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/_winapi.c Mon Dec 21 10:49:49 2015 +0200 @@ -675,7 +675,7 @@ static PyObject * /* helpers for createprocess */ static unsigned long -getulong(PyObject* obj, char* name) +getulong(PyObject* obj, const char* name) { PyObject* value; unsigned long ret; @@ -691,7 +691,7 @@ getulong(PyObject* obj, char* name) } static HANDLE -gethandle(PyObject* obj, char* name) +gethandle(PyObject* obj, const char* name) { PyObject* value; HANDLE ret; diff -r af0b95fb1c19 Modules/binascii.c --- a/Modules/binascii.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/binascii.c Mon Dec 21 10:49:49 2015 +0200 @@ -74,7 +74,7 @@ static PyObject *Incomplete; #define SKIP 0x7E #define FAIL 0x7D -static unsigned char table_a2b_hqx[256] = { +static const unsigned char table_a2b_hqx[256] = { /* ^@ ^A ^B ^C ^D ^E ^F ^G */ /* 0*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, /* \b \t \n ^K ^L \r ^N ^O */ @@ -125,10 +125,10 @@ static unsigned char table_a2b_hqx[256] FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, }; -static unsigned char table_b2a_hqx[] = +static const unsigned char table_b2a_hqx[] = "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr"; -static char table_a2b_base64[] = { +static const char table_a2b_base64[] = { -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, @@ -144,12 +144,12 @@ static char table_a2b_base64[] = { /* Max binary chunk size; limited only by available memory */ #define BASE64_MAXBIN ((PY_SSIZE_T_MAX - 3) / 2) -static unsigned char table_b2a_base64[] = +static const unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static unsigned short crctab_hqx[256] = { +static const unsigned short crctab_hqx[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, @@ -256,7 +256,8 @@ static PyObject * binascii_a2b_uu_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=5779f39b0b48459f input=7cafeaf73df63d1c]*/ { - unsigned char *ascii_data, *bin_data; + const unsigned char *ascii_data; + unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -342,7 +343,8 @@ static PyObject * binascii_b2a_uu_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=181021b69bb9a414 input=00fdf458ce8b465b]*/ { - unsigned char *ascii_data, *bin_data; + unsigned char *ascii_data; + const unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -389,7 +391,7 @@ binascii_b2a_uu_impl(PyModuleDef *module static int -binascii_find_valid(unsigned char *s, Py_ssize_t slen, int num) +binascii_find_valid(const unsigned char *s, Py_ssize_t slen, int num) { /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. @@ -426,7 +428,8 @@ static PyObject * binascii_a2b_base64_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=3e351b702bed56d2 input=5872acf6e1cac243]*/ { - unsigned char *ascii_data, *bin_data; + const unsigned char *ascii_data; + unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -522,7 +525,8 @@ static PyObject * binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data, int newline) /*[clinic end generated code: output=19e1dd719a890b50 input=7b2ea6fa38d8924c]*/ { - unsigned char *ascii_data, *bin_data; + unsigned char *ascii_data; + const unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -589,7 +593,8 @@ static PyObject * binascii_a2b_hqx_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=60bcdbbd28b105cd input=0d914c680e0eed55]*/ { - unsigned char *ascii_data, *bin_data; + const unsigned char *ascii_data; + unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -667,7 +672,8 @@ static PyObject * binascii_rlecode_hqx_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=0905da344dbf0648 input=e1f1712447a82b09]*/ { - unsigned char *in_data, *out_data; + const unsigned char *in_data; + unsigned char *out_data; unsigned char ch; Py_ssize_t in, inend, len; _PyBytesWriter writer; @@ -728,7 +734,8 @@ static PyObject * binascii_b2a_hqx_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=5a987810d5e3cdbb input=9596ebe019fe12ba]*/ { - unsigned char *ascii_data, *bin_data; + unsigned char *ascii_data; + const unsigned char *bin_data; int leftbits = 0; unsigned char this_ch; unsigned int leftchar = 0; @@ -782,7 +789,8 @@ static PyObject * binascii_rledecode_hqx_impl(PyModuleDef *module, Py_buffer *data) /*[clinic end generated code: output=f7afd89b789946ab input=54cdd49fc014402c]*/ { - unsigned char *in_data, *out_data; + const unsigned char *in_data; + unsigned char *out_data; unsigned char in_byte, in_repeat; Py_ssize_t in_len; _PyBytesWriter writer; @@ -899,7 +907,7 @@ static unsigned int binascii_crc_hqx_impl(PyModuleDef *module, Py_buffer *data, unsigned int crc) /*[clinic end generated code: output=167c2dac62625717 input=add8c53712ccceda]*/ { - unsigned char *bin_data; + const unsigned char *bin_data; Py_ssize_t len; crc &= 0xffff; @@ -977,7 +985,7 @@ binascii_crc_hqx_impl(PyModuleDef *modul using byte-swap instructions. ********************************************************************/ -static unsigned int crc_32_tab[256] = { +static const unsigned int crc_32_tab[256] = { 0x00000000U, 0x77073096U, 0xee0e612cU, 0x990951baU, 0x076dc419U, 0x706af48fU, 0xe963a535U, 0x9e6495a3U, 0x0edb8832U, 0x79dcb8a4U, 0xe0d5e91eU, 0x97d2d988U, 0x09b64c2bU, 0x7eb17cbdU, 0xe7b82d07U, @@ -1050,7 +1058,7 @@ binascii_crc32_impl(PyModuleDef *module, #ifdef USE_ZLIB_CRC32 /* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */ { - Byte *buf; + const Byte *buf; Py_ssize_t len; int signed_val; @@ -1061,7 +1069,7 @@ binascii_crc32_impl(PyModuleDef *module, } #else /* USE_ZLIB_CRC32 */ { /* By Jim Ahlstrom; All rights transferred to CNRI */ - unsigned char *bin_data; + const unsigned char *bin_data; Py_ssize_t len; unsigned int result; @@ -1144,7 +1152,7 @@ static PyObject * binascii_a2b_hex_impl(PyModuleDef *module, Py_buffer *hexstr) /*[clinic end generated code: output=d61da452b5c6d290 input=9e1e7f2f94db24fd]*/ { - char* argbuf; + const char* argbuf; Py_ssize_t arglen; PyObject *retval; char* retbuf; @@ -1201,7 +1209,7 @@ binascii_unhexlify_impl(PyModuleDef *mod return binascii_a2b_hex_impl(module, hexstr); } -static int table_hex[128] = { +static const int table_hex[128] = { -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, @@ -1232,7 +1240,8 @@ binascii_a2b_qp_impl(PyModuleDef *module { Py_ssize_t in, out; char ch; - unsigned char *ascii_data, *odata; + const unsigned char *ascii_data; + unsigned char *odata; Py_ssize_t datalen = 0; PyObject *rv; @@ -1338,13 +1347,14 @@ binascii_b2a_qp_impl(PyModuleDef *module /*[clinic end generated code: output=a87ca9ccb94e2a9f input=7f2a9aaa008e92b2]*/ { Py_ssize_t in, out; - unsigned char *databuf, *odata; + const unsigned char *databuf; + unsigned char *odata; Py_ssize_t datalen = 0, odatalen = 0; PyObject *rv; unsigned int linelen = 0; unsigned char ch; int crlf = 0; - unsigned char *p; + const unsigned char *p; databuf = data->buf; datalen = data->len; @@ -1353,7 +1363,7 @@ binascii_b2a_qp_impl(PyModuleDef *module /* XXX: this function has the side effect of converting all of * the end of lines to be the same depending on this detection * here */ - p = (unsigned char *) memchr(databuf, '\n', datalen); + p = (const unsigned char *) memchr(databuf, '\n', datalen); if ((p != NULL) && (p > databuf) && (*(p-1) == '\r')) crlf = 1; diff -r af0b95fb1c19 Modules/gcmodule.c --- a/Modules/gcmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/gcmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -738,7 +738,7 @@ handle_weakrefs(PyGC_Head *unreachable, } static void -debug_cycle(char *msg, PyObject *op) +debug_cycle(const char *msg, PyObject *op) { PySys_FormatStderr("gc: %s <%s %p>\n", msg, Py_TYPE(op)->tp_name, op); diff -r af0b95fb1c19 Modules/getaddrinfo.c --- a/Modules/getaddrinfo.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/getaddrinfo.c Mon Dec 21 10:49:49 2015 +0200 @@ -136,7 +136,7 @@ static int get_addr(const char *, int, s struct addrinfo *, int); static int str_isnumber(const char *); -static char *ai_errlist[] = { +static const char * const ai_errlist[] = { "success.", "address family for hostname not supported.", /* EAI_ADDRFAMILY */ "temporary failure in name resolution.", /* EAI_AGAIN */ @@ -198,7 +198,7 @@ if (pai->ai_flags & AI_CANONNAME) {\ #define ERR(err) { error = (err); goto bad; } -char * +const char * gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_MAX) diff -r af0b95fb1c19 Modules/main.c --- a/Modules/main.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/main.c Mon Dec 21 10:49:49 2015 +0200 @@ -42,11 +42,11 @@ static int orig_argc; #define PROGRAM_OPTS BASE_OPTS /* Short usage message (with %s for argv0) */ -static char *usage_line = +static const char *usage_line = "usage: %ls [option] ... [-c cmd | -m mod | file | -] [arg] ...\n"; /* Long usage message, split into parts < 512 bytes */ -static char *usage_1 = "\ +static const char *usage_1 = "\ Options and arguments (and corresponding environment variables):\n\ -b : issue warnings about str(bytes_instance), str(bytearray_instance)\n\ and comparing bytes/bytearray with str. (-bb: issue errors)\n\ @@ -56,7 +56,7 @@ Options and arguments (and corresponding -E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\ -h : print this help message and exit (also --help)\n\ "; -static char *usage_2 = "\ +static const char *usage_2 = "\ -i : inspect interactively after running script; forces a prompt even\n\ if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ -I : isolate Python from the user's environment (implies -E and -s)\n\ @@ -67,7 +67,7 @@ static char *usage_2 = "\ -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\ -S : don't imply 'import site' on initialization\n\ "; -static char *usage_3 = "\ +static const char *usage_3 = "\ -u : unbuffered binary stdout and stderr, stdin always buffered;\n\ also PYTHONUNBUFFERED=x\n\ see man page for details on internal buffering relating to '-u'\n\ @@ -79,7 +79,7 @@ static char *usage_3 = "\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ -X opt : set implementation-specific option\n\ "; -static char *usage_4 = "\ +static const char *usage_4 = "\ file : program read from script file\n\ - : program read from stdin (default; interactive mode if a tty)\n\ arg ...: arguments passed to program in sys.argv[1:]\n\n\ @@ -88,14 +88,14 @@ PYTHONSTARTUP: file executed on interact PYTHONPATH : '%c'-separated list of directories prefixed to the\n\ default module search path. The result is sys.path.\n\ "; -static char *usage_5 = +static const char *usage_5 = "PYTHONHOME : alternate directory (or %c).\n" " The default module search path uses %s.\n" "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" "PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n\ "; -static char *usage_6 = "\ +static const char *usage_6 = "\ PYTHONHASHSEED: if this variable is set to 'random', a random value is used\n\ to seed the hashes of str, bytes and datetime objects. It can also be\n\ set to an integer in the range [0,4294967295] to get hash values with a\n\ @@ -103,7 +103,7 @@ PYTHONHASHSEED: if this variable is set "; static int -usage(int exitcode, wchar_t* program) +usage(int exitcode, const wchar_t* program) { FILE *f = exitcode ? stderr : stdout; diff -r af0b95fb1c19 Modules/mathmodule.c --- a/Modules/mathmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/mathmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -876,7 +876,7 @@ math_1_to_int(PyObject *arg, double (*fu } static PyObject * -math_2(PyObject *args, double (*func) (double, double), char *funcname) +math_2(PyObject *args, double (*func) (double, double), const char *funcname) { PyObject *ox, *oy; double x, y, r; @@ -1673,7 +1673,7 @@ PyDoc_STRVAR(math_modf_doc, in that int is larger than PY_SSIZE_T_MAX. */ static PyObject* -loghelper(PyObject* arg, double (*func)(double), char *funcname) +loghelper(PyObject* arg, double (*func)(double), const char *funcname) { /* If it is int, do it ourselves. */ if (PyLong_Check(arg)) { diff -r af0b95fb1c19 Modules/ossaudiodev.c --- a/Modules/ossaudiodev.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/ossaudiodev.c Mon Dec 21 10:49:49 2015 +0200 @@ -238,7 +238,7 @@ static int _is_fd_valid(int fd) arg = dsp.xxx(arg) */ static PyObject * -_do_ioctl_1(int fd, PyObject *args, char *fname, int cmd) +_do_ioctl_1(int fd, PyObject *args, const char *fname, int cmd) { char argfmt[33] = "i:"; int arg; @@ -263,7 +263,7 @@ static PyObject * way. */ static PyObject * -_do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd) +_do_ioctl_1_internal(int fd, PyObject *args, const char *fname, int cmd) { char argfmt[32] = ":"; int arg = 0; @@ -283,7 +283,7 @@ static PyObject * /* _do_ioctl_0() is a private helper for the no-argument ioctls: SNDCTL_DSP_{SYNC,RESET,POST}. */ static PyObject * -_do_ioctl_0(int fd, PyObject *args, char *fname, int cmd) +_do_ioctl_0(int fd, PyObject *args, const char *fname, int cmd) { char argfmt[32] = ":"; int rv; @@ -1047,8 +1047,8 @@ static PyMethodDef ossaudiodev_methods[] if (PyModule_AddIntConstant(mod, #name, (long) (name)) == -1) return NULL; -static char *control_labels[] = SOUND_DEVICE_LABELS; -static char *control_names[] = SOUND_DEVICE_NAMES; +static const char * const control_labels[] = SOUND_DEVICE_LABELS; +static const char * const control_names[] = SOUND_DEVICE_NAMES; static int diff -r af0b95fb1c19 Modules/parsermodule.c --- a/Modules/parsermodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/parsermodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -53,7 +53,7 @@ extern grammar _PyParser_Grammar; /* Fro /* String constants used to initialize module attributes. * */ -static char parser_copyright_string[] = +static const char parser_copyright_string[] = "Copyright 1995-1996 by Virginia Polytechnic Institute & State\n\ University, Blacksburg, Virginia, USA, and Fred L. Drake, Jr., Reston,\n\ Virginia, USA. Portions copyright 1991-1995 by Stichting Mathematisch\n\ @@ -63,7 +63,7 @@ Centrum, Amsterdam, The Netherlands."; PyDoc_STRVAR(parser_doc_string, "This is an interface to Python's internal parser."); -static char parser_version_string[] = "0.5"; +static const char parser_version_string[] = "0.5"; typedef PyObject* (*SeqMaker) (Py_ssize_t length); @@ -578,13 +578,13 @@ parser_issuite(PyST_Object *self, PyObje } -/* err_string(char* message) +/* err_string(const char* message) * * Sets the error string for an exception of type ParserError. * */ static void -err_string(char *message) +err_string(const char *message) { PyErr_SetString(parser_error, message); } @@ -597,7 +597,7 @@ err_string(char *message) * */ static PyObject* -parser_do_parse(PyObject *args, PyObject *kw, char *argspec, int type) +parser_do_parse(PyObject *args, PyObject *kw, const char *argspec, int type) { char* string = 0; PyObject* res = 0; @@ -984,7 +984,7 @@ build_node_tree(PyObject *tuple) /* * Validation routines used within the validation section: */ -static int validate_terminal(node *terminal, int type, char *string); +static int validate_terminal(node *terminal, int type, const char *string); #define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") #define validate_circumflex(ch) validate_terminal(ch, CIRCUMFLEX, "^") @@ -1082,7 +1082,7 @@ validate_numnodes(node *n, int num, cons static int -validate_terminal(node *terminal, int type, char *string) +validate_terminal(node *terminal, int type, const char *string) { int res = (validate_ntype(terminal, type) && ((string == 0) || (strcmp(string, STR(terminal)) == 0))); diff -r af0b95fb1c19 Modules/posixmodule.c --- a/Modules/posixmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/posixmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -949,7 +949,8 @@ path_converter(PyObject *o, void *p) { } static void -argument_unavailable_error(char *function_name, char *argument_name) { +argument_unavailable_error(const char *function_name, const char *argument_name) +{ PyErr_Format(PyExc_NotImplementedError, "%s%s%s unavailable on this platform", (function_name != NULL) ? function_name : "", @@ -972,7 +973,8 @@ dir_fd_unavailable(PyObject *o, void *p) } static int -fd_specified(char *function_name, int fd) { +fd_specified(const char *function_name, int fd) +{ if (fd == -1) return 0; @@ -981,7 +983,8 @@ fd_specified(char *function_name, int fd } static int -follow_symlinks_specified(char *function_name, int follow_symlinks) { +follow_symlinks_specified(const char *function_name, int follow_symlinks) +{ if (follow_symlinks) return 0; @@ -990,7 +993,8 @@ follow_symlinks_specified(char *function } static int -path_and_dir_fd_invalid(char *function_name, path_t *path, int dir_fd) { +path_and_dir_fd_invalid(const char *function_name, path_t *path, int dir_fd) +{ if (!path->narrow && !path->wide && (dir_fd != DEFAULT_DIR_FD)) { PyErr_Format(PyExc_ValueError, "%s: can't specify dir_fd without matching path", @@ -1001,7 +1005,8 @@ path_and_dir_fd_invalid(char *function_n } static int -dir_fd_and_fd_invalid(char *function_name, int dir_fd, int fd) { +dir_fd_and_fd_invalid(const char *function_name, int dir_fd, int fd) +{ if ((dir_fd != DEFAULT_DIR_FD) && (fd != -1)) { PyErr_Format(PyExc_ValueError, "%s: can't specify both dir_fd and fd", @@ -1012,8 +1017,9 @@ dir_fd_and_fd_invalid(char *function_nam } static int -fd_and_follow_symlinks_invalid(char *function_name, int fd, - int follow_symlinks) { +fd_and_follow_symlinks_invalid(const char *function_name, int fd, + int follow_symlinks) +{ if ((fd > 0) && (!follow_symlinks)) { PyErr_Format(PyExc_ValueError, "%s: cannot use fd and follow_symlinks together", @@ -1024,8 +1030,9 @@ fd_and_follow_symlinks_invalid(char *fun } static int -dir_fd_and_follow_symlinks_invalid(char *function_name, int dir_fd, - int follow_symlinks) { +dir_fd_and_follow_symlinks_invalid(const char *function_name, int dir_fd, + int follow_symlinks) +{ if ((dir_fd != DEFAULT_DIR_FD) && (!follow_symlinks)) { PyErr_Format(PyExc_ValueError, "%s: cannot use dir_fd and follow_symlinks together", @@ -1220,7 +1227,7 @@ posix_error(void) #ifdef MS_WINDOWS static PyObject * -win32_error(char* function, const char* filename) +win32_error(const char* function, const char* filename) { /* XXX We should pass the function name along in the future. (winreg.c also wants to pass the function name.) @@ -1235,7 +1242,7 @@ win32_error(char* function, const char* } static PyObject * -win32_error_object(char* function, PyObject* filename) +win32_error_object(const char* function, PyObject* filename) { /* XXX - see win32_error for comments on 'function' */ errno = GetLastError(); @@ -2100,7 +2107,7 @@ static PyObject* static PyObject * -posix_do_stat(char *function_name, path_t *path, +posix_do_stat(const char *function_name, path_t *path, int dir_fd, int follow_symlinks) { STRUCT_STAT st; @@ -4561,7 +4568,7 @@ typedef struct { #if defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMENSAT) static int -utime_dir_fd(utime_t *ut, int dir_fd, char *path, int follow_symlinks) +utime_dir_fd(utime_t *ut, int dir_fd, const char *path, int follow_symlinks) { #ifdef HAVE_UTIMENSAT int flags = follow_symlinks ? 0 : AT_SYMLINK_NOFOLLOW; @@ -4610,7 +4617,7 @@ utime_fd(utime_t *ut, int fd) #ifdef UTIME_HAVE_NOFOLLOW_SYMLINKS static int -utime_nofollow_symlinks(utime_t *ut, char *path) +utime_nofollow_symlinks(utime_t *ut, const char *path) { #ifdef HAVE_UTIMENSAT UTIME_TO_TIMESPEC; @@ -4626,7 +4633,7 @@ utime_nofollow_symlinks(utime_t *ut, cha #ifndef MS_WINDOWS static int -utime_default(utime_t *ut, char *path) +utime_default(utime_t *ut, const char *path) { #ifdef HAVE_UTIMENSAT UTIME_TO_TIMESPEC; @@ -7323,7 +7330,7 @@ static int /* Return True if the path at src relative to dest is a directory */ static int -_check_dirA(char *src, char *dest) +_check_dirA(const char *src, char *dest) { WIN32_FILE_ATTRIBUTE_DATA src_info; char dest_parent[MAX_PATH]; @@ -11835,7 +11842,7 @@ error: #else /* POSIX */ static char * -join_path_filename(char *path_narrow, char* filename, Py_ssize_t filename_len) +join_path_filename(const char *path_narrow, const char* filename, Py_ssize_t filename_len) { Py_ssize_t path_len; Py_ssize_t size; @@ -11867,7 +11874,7 @@ join_path_filename(char *path_narrow, ch } static PyObject * -DirEntry_from_posix_info(path_t *path, char *name, Py_ssize_t name_len, +DirEntry_from_posix_info(path_t *path, const char *name, Py_ssize_t name_len, ino_t d_ino #ifdef HAVE_DIRENT_D_TYPE , unsigned char d_type diff -r af0b95fb1c19 Modules/pyexpat.c --- a/Modules/pyexpat.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/pyexpat.c Mon Dec 21 10:49:49 2015 +0200 @@ -91,7 +91,7 @@ static struct HandlerInfo handler_info[6 * false on an exception. */ static int -set_error_attr(PyObject *err, char *name, int value) +set_error_attr(PyObject *err, const char *name, int value) { PyObject *v = PyLong_FromLong(value); @@ -218,7 +218,7 @@ flag_error(xmlparseobject *self) } static PyObject* -call_with_frame(char *funcname, int lineno, PyObject* func, PyObject* args, +call_with_frame(const char *funcname, int lineno, PyObject* func, PyObject* args, xmlparseobject *self) { PyObject *res; @@ -766,7 +766,7 @@ readinst(char *buf, int buf_size, PyObje { PyObject *str; Py_ssize_t len; - char *ptr; + const char *ptr; str = PyObject_CallFunction(meth, "n", buf_size); if (str == NULL) diff -r af0b95fb1c19 Modules/selectmodule.c --- a/Modules/selectmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/selectmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -1842,7 +1842,7 @@ kqueue_event_init(kqueue_event_Object *s PyObject *pfd; static char *kwlist[] = {"ident", "filter", "flags", "fflags", "data", "udata", NULL}; - static char *fmt = "O|hHI" DATA_FMT_UNIT UINTPTRT_FMT_UNIT ":kevent"; + static const char *fmt = "O|hHI" DATA_FMT_UNIT UINTPTRT_FMT_UNIT ":kevent"; EV_SET(&(self->e), 0, EVFILT_READ, EV_ADD, 0, 0, 0); /* defaults */ diff -r af0b95fb1c19 Modules/socketmodule.c --- a/Modules/socketmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/socketmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -904,7 +904,7 @@ static PyThread_type_lock netdb_lock; an error occurred; then an exception is raised. */ static int -setipaddr(char *name, struct sockaddr *addr_ret, size_t addr_ret_size, int af) +setipaddr(const char *name, struct sockaddr *addr_ret, size_t addr_ret_size, int af) { struct addrinfo hints, *res; int error; @@ -1085,7 +1085,7 @@ makeipaddr(struct sockaddr *addr, int ad an error occurred. */ static int -setbdaddr(char *name, bdaddr_t *bdaddr) +setbdaddr(const char *name, bdaddr_t *bdaddr) { unsigned int b0, b1, b2, b3, b4, b5; char ch; diff -r af0b95fb1c19 Modules/timemodule.c --- a/Modules/timemodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/timemodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -311,7 +311,7 @@ tmtotuple(struct tm *p) Returns non-zero on success (parallels PyArg_ParseTuple). */ static int -parse_time_t_args(PyObject *args, char *format, time_t *pwhen) +parse_time_t_args(PyObject *args, const char *format, time_t *pwhen) { PyObject *ot = NULL; time_t whent; @@ -732,10 +732,10 @@ static PyObject * { /* Inspired by Open Group reference implementation available at * http://pubs.opengroup.org/onlinepubs/009695399/functions/asctime.html */ - static char wday_name[7][4] = { + static const char wday_name[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static char mon_name[12][4] = { + static const char mon_name[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; diff -r af0b95fb1c19 Modules/unicodedata.c --- a/Modules/unicodedata.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/unicodedata.c Mon Dec 21 10:49:49 2015 +0200 @@ -884,7 +884,7 @@ static unsigned long return h; } -static char *hangul_syllables[][3] = { +static const char * const hangul_syllables[][3] = { { "G", "A", "" }, { "GG", "AE", "G" }, { "N", "YA", "GG" }, @@ -1057,7 +1057,7 @@ find_syllable(const char *str, int *len, int i, len1; *len = -1; for (i = 0; i < count; i++) { - char *s = hangul_syllables[i][column]; + const char *s = hangul_syllables[i][column]; len1 = Py_SAFE_DOWNCAST(strlen(s), size_t, int); if (len1 <= *len) continue; diff -r af0b95fb1c19 Modules/xxlimited.c --- a/Modules/xxlimited.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/xxlimited.c Mon Dec 21 10:49:49 2015 +0200 @@ -89,7 +89,7 @@ Xxo_getattro(XxoObject *self, PyObject * } static int -Xxo_setattr(XxoObject *self, char *name, PyObject *v) +Xxo_setattr(XxoObject *self, const char *name, PyObject *v) { if (self->x_attr == NULL) { self->x_attr = PyDict_New(); diff -r af0b95fb1c19 Modules/xxmodule.c --- a/Modules/xxmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/xxmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -76,7 +76,7 @@ Xxo_getattro(XxoObject *self, PyObject * } static int -Xxo_setattr(XxoObject *self, char *name, PyObject *v) +Xxo_setattr(XxoObject *self, const char *name, PyObject *v) { if (self->x_attr == NULL) { self->x_attr = PyDict_New(); diff -r af0b95fb1c19 Modules/zlibmodule.c --- a/Modules/zlibmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Modules/zlibmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -53,7 +53,7 @@ typedef struct } compobject; static void -zlib_error(z_stream zst, int err, char *msg) +zlib_error(z_stream zst, int err, const char *msg) { const char *zmsg = Z_NULL; /* In case of a version mismatch, zst.msg won't be initialized. diff -r af0b95fb1c19 Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/bytearrayobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -2576,8 +2576,8 @@ bytearray_remove_impl(PyByteArrayObject /* XXX These two helpers could be optimized if argsize == 1 */ static Py_ssize_t -lstrip_helper(char *myptr, Py_ssize_t mysize, - void *argptr, Py_ssize_t argsize) +lstrip_helper(const char *myptr, Py_ssize_t mysize, + const void *argptr, Py_ssize_t argsize) { Py_ssize_t i = 0; while (i < mysize && memchr(argptr, (unsigned char) myptr[i], argsize)) @@ -2586,8 +2586,8 @@ lstrip_helper(char *myptr, Py_ssize_t my } static Py_ssize_t -rstrip_helper(char *myptr, Py_ssize_t mysize, - void *argptr, Py_ssize_t argsize) +rstrip_helper(const char *myptr, Py_ssize_t mysize, + const void *argptr, Py_ssize_t argsize) { Py_ssize_t i = mysize - 1; while (i >= 0 && memchr(argptr, (unsigned char) myptr[i], argsize)) diff -r af0b95fb1c19 Objects/bytes_methods.c --- a/Objects/bytes_methods.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/bytes_methods.c Mon Dec 21 10:49:49 2015 +0200 @@ -277,7 +277,7 @@ Return a titlecased version of B, i.e. A characters, all remaining cased characters have lowercase."); void -_Py_bytes_title(char *result, char *s, Py_ssize_t len) +_Py_bytes_title(char *result, const char *s, Py_ssize_t len) { Py_ssize_t i; int previous_is_cased = 0; @@ -306,7 +306,7 @@ Return a copy of B with only its first c and the rest lower-cased."); void -_Py_bytes_capitalize(char *result, char *s, Py_ssize_t len) +_Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len) { Py_ssize_t i; @@ -336,7 +336,7 @@ Return a copy of B with uppercase ASCII to lowercase ASCII and vice versa."); void -_Py_bytes_swapcase(char *result, char *s, Py_ssize_t len) +_Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len) { Py_ssize_t i; diff -r af0b95fb1c19 Objects/bytesobject.c --- a/Objects/bytesobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/bytesobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -308,7 +308,7 @@ PyBytes_FromFormatV(const char *format, { Py_ssize_t i; - p = va_arg(vargs, char*); + p = va_arg(vargs, const char*); i = strlen(p); if (prec > 0 && i > prec) i = prec; diff -r af0b95fb1c19 Objects/descrobject.c --- a/Objects/descrobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/descrobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -22,7 +22,7 @@ descr_name(PyDescrObject *descr) } static PyObject * -descr_repr(PyDescrObject *descr, char *format) +descr_repr(PyDescrObject *descr, const char *format) { PyObject *name = NULL; if (descr->d_name != NULL && PyUnicode_Check(descr->d_name)) diff -r af0b95fb1c19 Objects/dictobject.c --- a/Objects/dictobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/dictobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -1925,7 +1925,7 @@ dict_fromkeys_impl(PyTypeObject *type, P } static int -dict_update_common(PyObject *self, PyObject *args, PyObject *kwds, char *methname) +dict_update_common(PyObject *self, PyObject *args, PyObject *kwds, const char *methname) { PyObject *arg = NULL; int result = 0; diff -r af0b95fb1c19 Objects/memoryobject.c --- a/Objects/memoryobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/memoryobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -1133,7 +1133,7 @@ get_native_fmtchar(char *result, const c return -1; } -Py_LOCAL_INLINE(char *) +Py_LOCAL_INLINE(const char *) get_native_fmtstr(const char *fmt) { int at = 0; @@ -1221,7 +1221,7 @@ cast_to_1D(PyMemoryViewObject *mv, PyObj goto out; } - view->format = get_native_fmtstr(PyBytes_AS_STRING(asciifmt)); + view->format = (char *)get_native_fmtstr(PyBytes_AS_STRING(asciifmt)); if (view->format == NULL) { /* NOT_REACHED: get_native_fmtchar() already validates the format. */ PyErr_SetString(PyExc_RuntimeError, diff -r af0b95fb1c19 Objects/object.c --- a/Objects/object.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/object.c Mon Dec 21 10:49:49 2015 +0200 @@ -644,7 +644,7 @@ PyObject_Bytes(PyObject *v) /* Map rich comparison operators to their swapped version, e.g. LT <--> GT */ int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE}; -static char *opstrings[] = {"<", "<=", "==", "!=", ">", ">="}; +static const char * const opstrings[] = {"<", "<=", "==", "!=", ">", ">="}; /* Perform a rich comparison, raising TypeError when the requested comparison operator is not supported. */ diff -r af0b95fb1c19 Objects/structseq.c --- a/Objects/structseq.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/structseq.c Mon Dec 21 10:49:49 2015 +0200 @@ -4,9 +4,9 @@ #include "Python.h" #include "structmember.h" -static char visible_length_key[] = "n_sequence_fields"; -static char real_length_key[] = "n_fields"; -static char unnamed_fields_key[] = "n_unnamed_fields"; +static const char visible_length_key[] = "n_sequence_fields"; +static const char real_length_key[] = "n_fields"; +static const char unnamed_fields_key[] = "n_unnamed_fields"; /* Fields with this name have only a field index, not a field name. They are only allowed for indices < n_visible_fields. */ diff -r af0b95fb1c19 Objects/typeobject.c --- a/Objects/typeobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/typeobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -566,7 +566,7 @@ type_get_bases(PyTypeObject *type, void static PyTypeObject *best_base(PyObject *); static int mro_internal(PyTypeObject *, PyObject **); Py_LOCAL_INLINE(int) type_is_subtype_base_chain(PyTypeObject *, PyTypeObject *); -static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, char *); +static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, const char *); static int add_subclass(PyTypeObject*, PyTypeObject*); static int add_all_subclasses(PyTypeObject *type, PyObject *bases); static void remove_subclass(PyTypeObject *, PyTypeObject *); @@ -1437,7 +1437,7 @@ PyObject * as lookup_method to cache the interned name string object. */ static PyObject * -call_method(PyObject *o, _Py_Identifier *nameid, char *format, ...) +call_method(PyObject *o, _Py_Identifier *nameid, const char *format, ...) { va_list va; PyObject *args, *func = 0, *retval; @@ -1473,7 +1473,7 @@ call_method(PyObject *o, _Py_Identifier /* Clone of call_method() that returns NotImplemented when the lookup fails. */ static PyObject * -call_maybe(PyObject *o, _Py_Identifier *nameid, char *format, ...) +call_maybe(PyObject *o, _Py_Identifier *nameid, const char *format, ...) { va_list va; PyObject *args, *func = 0, *retval; @@ -3612,7 +3612,7 @@ same_slots_added(PyTypeObject *a, PyType } static int -compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, char* attr) +compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, const char* attr) { PyTypeObject *newbase, *oldbase; @@ -5351,7 +5351,7 @@ wrap_delitem(PyObject *self, PyObject *a /* Helper to check for object.__setattr__ or __delattr__ applied to a type. This is called the Carlo Verre hack after its discoverer. */ static int -hackcheck(PyObject *self, setattrofunc func, char *what) +hackcheck(PyObject *self, setattrofunc func, const char *what) { PyTypeObject *type = Py_TYPE(self); while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) diff -r af0b95fb1c19 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/unicodeobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -6988,7 +6988,7 @@ PyUnicode_AsASCIIString(PyObject *unicod # define WC_ERR_INVALID_CHARS 0x0080 #endif -static char* +static const char* code_page_name(UINT code_page, PyObject **obj) { *obj = NULL; @@ -7096,7 +7096,7 @@ decode_code_page_errors(UINT code_page, PyObject *errorHandler = NULL; PyObject *exc = NULL; PyObject *encoding_obj = NULL; - char *encoding; + const char *encoding; DWORD err; int ret = -1; @@ -7440,7 +7440,7 @@ encode_code_page_errors(UINT code_page, PyObject *errorHandler = NULL; PyObject *exc = NULL; PyObject *encoding_obj = NULL; - char *encoding; + const char *encoding; Py_ssize_t newpos, newoutsize; PyObject *rep; int ret = -1; diff -r af0b95fb1c19 Objects/weakrefobject.c --- a/Objects/weakrefobject.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Objects/weakrefobject.c Mon Dec 21 10:49:49 2015 +0200 @@ -265,7 +265,7 @@ insert_head(PyWeakReference *newref, PyW } static int -parse_weakref_init_args(char *funcname, PyObject *args, PyObject *kwargs, +parse_weakref_init_args(const char *funcname, PyObject *args, PyObject *kwargs, PyObject **obp, PyObject **callbackp) { /* XXX Should check that kwargs == NULL or is empty. */ diff -r af0b95fb1c19 PC/_msi.c --- a/PC/_msi.c Sun Dec 20 16:37:21 2015 +0200 +++ b/PC/_msi.c Mon Dec 21 10:49:49 2015 +0200 @@ -1008,7 +1008,7 @@ static PyMethodDef msi_methods[] = { {NULL, NULL} /* sentinel */ }; -static char msi_doc[] = "Documentation"; +static const char msi_doc[] = "Documentation"; static struct PyModuleDef _msimodule = { diff -r af0b95fb1c19 PC/frozen_dllmain.c --- a/PC/frozen_dllmain.c Sun Dec 20 16:37:21 2015 +0200 +++ b/PC/frozen_dllmain.c Mon Dec 21 10:49:49 2015 +0200 @@ -46,14 +46,14 @@ changed, here is a snippet from the pyth ***************************************************************************/ #include "windows.h" -static char *possibleModules[] = { +static const char * const possibleModules[] = { "pywintypes", "pythoncom", "win32ui", NULL, }; -BOOL CallModuleDllMain(char *modName, DWORD dwReason); +BOOL CallModuleDllMain(const char *modName, DWORD dwReason); /* @@ -62,7 +62,7 @@ BOOL CallModuleDllMain(char *modName, DW */ void PyWinFreeze_ExeInit(void) { - char **modName; + const char * const *modName; for (modName = possibleModules;*modName;*modName++) { /* printf("Initialising '%s'\n", *modName); */ CallModuleDllMain(*modName, DLL_PROCESS_ATTACH); @@ -76,7 +76,7 @@ void PyWinFreeze_ExeInit(void) void PyWinFreeze_ExeTerm(void) { // Must go backwards - char **modName; + const char * const *modName; for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2; modName >= possibleModules; *modName--) { @@ -91,7 +91,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, switch (dwReason) { case DLL_PROCESS_ATTACH: { - char **modName; + const char * const *modName; for (modName = possibleModules;*modName;*modName++) { BOOL ok = CallModuleDllMain(*modName, dwReason); if (!ok) @@ -102,7 +102,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, case DLL_PROCESS_DETACH: { // Must go backwards - char **modName; + const char * const *modName; for (modName = possibleModules+Py_ARRAY_LENGTH(possibleModules)-2; modName >= possibleModules; *modName--) @@ -113,7 +113,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, return ret; } -BOOL CallModuleDllMain(char *modName, DWORD dwReason) +BOOL CallModuleDllMain(const char *modName, DWORD dwReason) { BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID); diff -r af0b95fb1c19 PC/launcher.c --- a/PC/launcher.c Sun Dec 20 16:37:21 2015 +0200 +++ b/PC/launcher.c Mon Dec 21 10:49:49 2015 +0200 @@ -963,7 +963,7 @@ typedef struct { * Strictly, we don't need to handle UTF-16 and UTF-32, since Python itself * doesn't. Never mind, one day it might - there's no harm leaving it in. */ -static BOM BOMs[] = { +static const BOM BOMs[] = { { 3, { 0xEF, 0xBB, 0xBF }, CP_UTF8 }, /* UTF-8 - keep first */ /* Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix * of UTF-32LE BOM. */ @@ -974,15 +974,15 @@ static BOM BOMs[] = { { 0 } /* sentinel */ }; -static BOM * -find_BOM(char * buffer) +static const BOM * +find_BOM(const char * buffer) { /* * Look for a BOM in the input and return a pointer to the * corresponding structure, or NULL if not found. */ - BOM * result = NULL; - BOM *bom; + const BOM *result = NULL; + const BOM *bom; for (bom = BOMs; bom->length; bom++) { if (strncmp(bom->sequence, buffer, bom->length) == 0) { @@ -993,12 +993,12 @@ find_BOM(char * buffer) return result; } -static char * -find_terminator(char * buffer, int len, BOM *bom) +static const char * +find_terminator(const char * buffer, int len, const BOM *bom) { - char * result = NULL; - char * end = buffer + len; - char * p; + const char *result = NULL; + const char *end = buffer + len; + const char *p; char c; int cp; @@ -1028,7 +1028,7 @@ find_terminator(char * buffer, int len, } static BOOL -validate_version(wchar_t * p) +validate_version(const wchar_t * p) { BOOL result = TRUE; @@ -1111,10 +1111,10 @@ maybe_handle_shebang(wchar_t ** argv, wc char buffer[BUFSIZE]; wchar_t shebang_line[BUFSIZE + 1]; size_t read; - char *p; - char * start; + const char *p; + const char * start; char * shebang_alias = (char *) shebang_line; - BOM* bom; + const BOM *bom; int i, j, nchars = 0; int header_len; BOOL is_virt; diff -r af0b95fb1c19 PC/msvcrtmodule.c --- a/PC/msvcrtmodule.c Sun Dec 20 16:37:21 2015 +0200 +++ b/PC/msvcrtmodule.c Mon Dec 21 10:49:49 2015 +0200 @@ -494,7 +494,7 @@ static struct PyModuleDef msvcrtmodule = }; static void -insertint(PyObject *d, char *name, int value) +insertint(PyObject *d, const char *name, int value) { PyObject *v = PyLong_FromLong((long) value); if (v == NULL) { diff -r af0b95fb1c19 PC/winreg.c --- a/PC/winreg.c Sun Dec 20 16:37:21 2015 +0200 +++ b/PC/winreg.c Mon Dec 21 10:49:49 2015 +0200 @@ -21,7 +21,7 @@ static BOOL clinic_HKEY_converter(PyObje static PyObject *PyHKEY_FromHKEY(HKEY h); static BOOL PyHKEY_Close(PyObject *obHandle); -static char errNotAHandle[] = "Object is not a handle"; +static const char errNotAHandle[] = "Object is not a handle"; /* The win32api module reports the function name that failed, but this concept is not in the Python core. @@ -112,7 +112,7 @@ typedef struct { #define PyHKEY_Check(op) ((op)->ob_type == &PyHKEY_Type) -static char *failMsg = "bad operand type"; +static const char *failMsg = "bad operand type"; static PyObject * PyHKEY_unaryFailureFunc(PyObject *ob) @@ -1813,7 +1813,7 @@ static struct PyMethodDef winreg_methods }; static void -insint(PyObject * d, char * name, long value) +insint(PyObject *d, const char *name, long value) { PyObject *v = PyLong_FromLong(value); if (!v || PyDict_SetItemString(d, name, v)) @@ -1824,7 +1824,7 @@ insint(PyObject * d, char * name, long v #define ADD_INT(val) insint(d, #val, val) static void -inskey(PyObject * d, char * name, HKEY key) +inskey(PyObject *d, const char *name, HKEY key) { PyObject *v = PyLong_FromVoidPtr(key); if (!v || PyDict_SetItemString(d, name, v)) diff -r af0b95fb1c19 Parser/parsetok.c --- a/Parser/parsetok.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Parser/parsetok.c Mon Dec 21 10:49:49 2015 +0200 @@ -161,10 +161,10 @@ PyParser_ParseFileFlagsEx(FILE *fp, cons #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD #if 0 -static char with_msg[] = +static const char with_msg[] = "%s:%d: Warning: 'with' will become a reserved keyword in Python 2.6\n"; -static char as_msg[] = +static const char as_msg[] = "%s:%d: Warning: 'as' will become a reserved keyword in Python 2.6\n"; static void diff -r af0b95fb1c19 Parser/pgen.c --- a/Parser/pgen.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Parser/pgen.c Mon Dec 21 10:49:49 2015 +0200 @@ -134,7 +134,7 @@ addnfa(nfagrammar *gr, char *name) #ifdef Py_DEBUG -static char REQNFMT[] = "metacompile: less than %d children\n"; +static const char REQNFMT[] = "metacompile: less than %d children\n"; #define REQN(i, count) do { \ if (i < count) { \ @@ -379,7 +379,7 @@ typedef struct _ss_dfa { /* Forward */ static void printssdfa(int xx_nstates, ss_state *xx_state, int nbits, - labellist *ll, char *msg); + labellist *ll, const char *msg); static void simplify(int xx_nstates, ss_state *xx_state); static void convert(dfa *d, int xx_nstates, ss_state *xx_state); @@ -494,7 +494,7 @@ makedfa(nfagrammar *gr, nfa *nf, dfa *d) static void printssdfa(int xx_nstates, ss_state *xx_state, int nbits, - labellist *ll, char *msg) + labellist *ll, const char *msg) { int i, ibit, iarc; ss_state *yy; diff -r af0b95fb1c19 Parser/pgenmain.c --- a/Parser/pgenmain.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Parser/pgenmain.c Mon Dec 21 10:49:49 2015 +0200 @@ -27,7 +27,7 @@ int Py_VerboseFlag; int Py_IgnoreEnvironmentFlag; /* Forward */ -grammar *getgrammar(char *filename); +grammar *getgrammar(const char *filename); void Py_Exit(int) _Py_NO_RETURN; @@ -76,7 +76,7 @@ main(int argc, char **argv) } grammar * -getgrammar(char *filename) +getgrammar(const char *filename) { FILE *fp; node *n; diff -r af0b95fb1c19 Parser/tokenizer.c --- a/Parser/tokenizer.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Parser/tokenizer.c Mon Dec 21 10:49:49 2015 +0200 @@ -202,8 +202,8 @@ error_ret(struct tok_state *tok) /* XXX } -static char * -get_normal_name(char *s) /* for utf-8 and latin-1 */ +static const char * +get_normal_name(const char *s) /* for utf-8 and latin-1 */ { char buf[13]; int i; @@ -264,7 +264,7 @@ get_coding_spec(const char *s, char **sp if (begin < t) { char* r = new_string(begin, t - begin, tok); - char* q; + const char* q; if (!r) return 0; q = get_normal_name(r); diff -r af0b95fb1c19 Python/_warnings.c --- a/Python/_warnings.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/_warnings.c Mon Dec 21 10:49:49 2015 +0200 @@ -922,7 +922,7 @@ PyErr_WarnEx(PyObject *category, const c #undef PyErr_Warn PyAPI_FUNC(int) -PyErr_Warn(PyObject *category, char *text) +PyErr_Warn(PyObject *category, const char *text) { return PyErr_WarnEx(category, text, 1); } diff -r af0b95fb1c19 Python/ceval.c --- a/Python/ceval.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/ceval.c Mon Dec 21 10:49:49 2015 +0200 @@ -125,7 +125,7 @@ static PyObject * load_args(PyObject *** #ifdef LLTRACE static int lltrace; -static int prtrace(PyObject *, char *); +static int prtrace(PyObject *, const char *); #endif static int call_trace(Py_tracefunc, PyObject *, PyThreadState *, PyFrameObject *, @@ -4309,7 +4309,7 @@ Error: #ifdef LLTRACE static int -prtrace(PyObject *v, char *str) +prtrace(PyObject *v, const char *str) { printf("%s ", str); if (PyObject_Print(v, stdout, 0) != 0) diff -r af0b95fb1c19 Python/dtoa.c --- a/Python/dtoa.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/dtoa.c Mon Dec 21 10:49:49 2015 +0200 @@ -2315,7 +2315,7 @@ rv_alloc(int i) } static char * -nrv_alloc(char *s, char **rve, int n) +nrv_alloc(const char *s, char **rve, int n) { char *rv, *t; diff -r af0b95fb1c19 Python/dynload_win.c --- a/Python/dynload_win.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/dynload_win.c Mon Dec 21 10:49:49 2015 +0200 @@ -41,7 +41,7 @@ const char *_PyImport_DynLoadFiletab[] = /* Case insensitive string compare, to avoid any dependencies on particular C RTL implementations */ -static int strcasecmp (char *string1, char *string2) +static int strcasecmp (const char *string1, const char *string2) { int first, second; diff -r af0b95fb1c19 Python/formatter_unicode.c --- a/Python/formatter_unicode.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/formatter_unicode.c Mon Dec 21 10:49:49 2015 +0200 @@ -656,7 +656,7 @@ fill_number(_PyUnicodeWriter *writer, co return 0; } -static char no_grouping[1] = {CHAR_MAX}; +static const char no_grouping[1] = {CHAR_MAX}; /* Find the decimal point character(s?), thousands_separator(s?), and grouping description, either for the current locale if type is diff -r af0b95fb1c19 Python/getargs.c --- a/Python/getargs.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/getargs.c Mon Dec 21 10:49:49 2015 +0200 @@ -20,12 +20,12 @@ int PyArg_VaParseTupleAndKeywords(PyObje #ifdef HAVE_DECLSPEC_DLL /* Export functions */ -PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, char *, ...); -PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, char *, ...); +PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, const char *, ...); +PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, const char *, ...); PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywords_SizeT(PyObject *, PyObject *, const char *, char **, ...); PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); -PyAPI_FUNC(int) _PyArg_VaParse_SizeT(PyObject *, char *, va_list); +PyAPI_FUNC(int) _PyArg_VaParse_SizeT(PyObject *, const char *, va_list); PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *, PyObject *, const char *, char **, va_list); #endif @@ -56,18 +56,18 @@ typedef struct { /* Forward */ static int vgetargs1(PyObject *, const char *, va_list *, int); static void seterror(Py_ssize_t, const char *, int *, const char *, const char *); -static char *convertitem(PyObject *, const char **, va_list *, int, int *, - char *, size_t, freelist_t *); -static char *converttuple(PyObject *, const char **, va_list *, int, - int *, char *, size_t, int, freelist_t *); -static char *convertsimple(PyObject *, const char **, va_list *, int, char *, - size_t, freelist_t *); -static Py_ssize_t convertbuffer(PyObject *, void **p, char **); -static int getbuffer(PyObject *, Py_buffer *, char**); +static const char *convertitem(PyObject *, const char **, va_list *, int, int *, + char *, size_t, freelist_t *); +static const char *converttuple(PyObject *, const char **, va_list *, int, + int *, char *, size_t, int, freelist_t *); +static const char *convertsimple(PyObject *, const char **, va_list *, int, + char *, size_t, freelist_t *); +static Py_ssize_t convertbuffer(PyObject *, void **p, const char **); +static int getbuffer(PyObject *, Py_buffer *, const char**); static int vgetargskeywords(PyObject *, PyObject *, const char *, char **, va_list *, int); -static char *skipitem(const char **, va_list *, int); +static const char *skipitem(const char **, va_list *, int); int PyArg_Parse(PyObject *args, const char *format, ...) @@ -82,7 +82,7 @@ PyArg_Parse(PyObject *args, const char * } int -_PyArg_Parse_SizeT(PyObject *args, char *format, ...) +_PyArg_Parse_SizeT(PyObject *args, const char *format, ...) { int retval; va_list va; @@ -107,7 +107,7 @@ PyArg_ParseTuple(PyObject *args, const c } int -_PyArg_ParseTuple_SizeT(PyObject *args, char *format, ...) +_PyArg_ParseTuple_SizeT(PyObject *args, const char *format, ...) { int retval; va_list va; @@ -130,7 +130,7 @@ PyArg_VaParse(PyObject *args, const char } int -_PyArg_VaParse_SizeT(PyObject *args, char *format, va_list va) +_PyArg_VaParse_SizeT(PyObject *args, const char *format, va_list va) { va_list lva; @@ -208,7 +208,7 @@ vgetargs1(PyObject *args, const char *fo int endfmt = 0; const char *formatsave = format; Py_ssize_t i, len; - char *msg; + const char *msg; int compat = flags & FLAG_COMPAT; freelistentry_t static_entries[STATIC_FREELIST_ENTRIES]; freelist_t freelist; @@ -416,7 +416,7 @@ seterror(Py_ssize_t iarg, const char *ms and msgbuf is returned. */ -static char * +static const char * converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags, int *levels, char *msgbuf, size_t bufsize, int toplevel, freelist_t *freelist) @@ -474,7 +474,7 @@ converttuple(PyObject *arg, const char * format = *p_format; for (i = 0; i < n; i++) { - char *msg; + const char *msg; PyObject *item; item = PySequence_GetItem(arg, i); if (item == NULL) { @@ -501,11 +501,11 @@ converttuple(PyObject *arg, const char * /* Convert a single item. */ -static char * +static const char * convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags, int *levels, char *msgbuf, size_t bufsize, freelist_t *freelist) { - char *msg; + const char *msg; const char *format = *p_format; if (*format == '(' /* ')' */) { @@ -530,7 +530,7 @@ convertitem(PyObject *arg, const char ** /* Format an error message generated by convertsimple(). */ -static char * +static const char * converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize) { assert(expected != NULL); @@ -566,7 +566,7 @@ float_argument_error(PyObject *arg) When you add new format codes, please don't forget poor skipitem() below. */ -static char * +static const char * convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, char *msgbuf, size_t bufsize, freelist_t *freelist) { @@ -851,7 +851,7 @@ convertsimple(PyObject *arg, const char case 'y': {/* any bytes-like object */ void **p = (void **)va_arg(*p_va, char **); - char *buf; + const char *buf; Py_ssize_t count; if (*format == '*') { if (getbuffer(arg, (Py_buffer*)p, &buf) < 0) @@ -898,7 +898,7 @@ convertsimple(PyObject *arg, const char PyBuffer_FillInfo(p, arg, sarg, len, 1, 0); } else { /* any bytes-like object */ - char *buf; + const char *buf; if (getbuffer(arg, p, &buf) < 0) return converterr(buf, arg, msgbuf, bufsize); } @@ -928,7 +928,7 @@ convertsimple(PyObject *arg, const char } else { /* read-only bytes-like object */ /* XXX Really? */ - char *buf; + const char *buf; Py_ssize_t count = convertbuffer(arg, p, &buf); if (count < 0) return converterr(buf, arg, msgbuf, bufsize); @@ -1275,7 +1275,7 @@ convertsimple(PyObject *arg, const char } static Py_ssize_t -convertbuffer(PyObject *arg, void **p, char **errmsg) +convertbuffer(PyObject *arg, void **p, const char **errmsg) { PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer; Py_ssize_t count; @@ -1297,7 +1297,7 @@ convertbuffer(PyObject *arg, void **p, c } static int -getbuffer(PyObject *arg, Py_buffer *view, char **errmsg) +getbuffer(PyObject *arg, Py_buffer *view, const char **errmsg) { if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) { *errmsg = "bytes-like object"; @@ -1629,7 +1629,7 @@ vgetargskeywords(PyObject *args, PyObjec } -static char * +static const char * skipitem(const char **p_format, va_list *p_va, int flags) { const char *format = *p_format; @@ -1722,7 +1722,7 @@ skipitem(const char **p_format, va_list case '(': /* bypass tuple, not handled at all previously */ { - char *msg; + const char *msg; for (;;) { if (*format==')') break; diff -r af0b95fb1c19 Python/import.c --- a/Python/import.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/import.c Mon Dec 21 10:49:49 2015 +0200 @@ -320,7 +320,7 @@ PyImport_GetModuleDict(void) /* List of names to clear in sys */ -static char* sys_deletes[] = { +static const char * const sys_deletes[] = { "path", "argv", "ps1", "ps2", "last_type", "last_value", "last_traceback", "path_hooks", "path_importer_cache", "meta_path", @@ -330,7 +330,7 @@ static char* sys_deletes[] = { NULL }; -static char* sys_files[] = { +static const char * const sys_files[] = { "stdin", "__stdin__", "stdout", "__stdout__", "stderr", "__stderr__", @@ -347,7 +347,7 @@ PyImport_Cleanup(void) PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; PyObject *weaklist = NULL; - char **p; + const char * const *p; if (modules == NULL) return; /* Already done */ diff -r af0b95fb1c19 Python/marshal.c --- a/Python/marshal.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/marshal.c Mon Dec 21 10:49:49 2015 +0200 @@ -643,7 +643,7 @@ typedef struct { PyObject *refs; /* a list */ } RFILE; -static char * +static const char * r_string(Py_ssize_t n, RFILE *p) { Py_ssize_t read = -1; @@ -729,7 +729,7 @@ r_byte(RFILE *p) c = getc(p->fp); } else { - char *ptr = r_string(1, p); + const char *ptr = r_string(1, p); if (ptr != NULL) c = *(unsigned char *) ptr; } @@ -740,9 +740,9 @@ static int r_short(RFILE *p) { short x = -1; - unsigned char *buffer; + const unsigned char *buffer; - buffer = (unsigned char *) r_string(2, p); + buffer = (const unsigned char *) r_string(2, p); if (buffer != NULL) { x = buffer[0]; x |= buffer[1] << 8; @@ -756,9 +756,9 @@ static long r_long(RFILE *p) { long x = -1; - unsigned char *buffer; + const unsigned char *buffer; - buffer = (unsigned char *) r_string(4, p); + buffer = (const unsigned char *) r_string(4, p); if (buffer != NULL) { x = buffer[0]; x |= (long)buffer[1] << 8; @@ -978,7 +978,8 @@ r_object(RFILE *p) case TYPE_FLOAT: { - char buf[256], *ptr; + char buf[256]; + const char *ptr; double dx; n = r_byte(p); if (n == EOF) { @@ -1001,9 +1002,9 @@ r_object(RFILE *p) case TYPE_BINARY_FLOAT: { - unsigned char *buf; + const unsigned char *buf; double x; - buf = (unsigned char *) r_string(8, p); + buf = (const unsigned char *) r_string(8, p); if (buf == NULL) break; x = _PyFloat_Unpack8(buf, 1); @@ -1016,7 +1017,8 @@ r_object(RFILE *p) case TYPE_COMPLEX: { - char buf[256], *ptr; + char buf[256]; + const char *ptr; Py_complex c; n = r_byte(p); if (n == EOF) { @@ -1053,15 +1055,15 @@ r_object(RFILE *p) case TYPE_BINARY_COMPLEX: { - unsigned char *buf; + const unsigned char *buf; Py_complex c; - buf = (unsigned char *) r_string(8, p); + buf = (const unsigned char *) r_string(8, p); if (buf == NULL) break; c.real = _PyFloat_Unpack8(buf, 1); if (c.real == -1.0 && PyErr_Occurred()) break; - buf = (unsigned char *) r_string(8, p); + buf = (const unsigned char *) r_string(8, p); if (buf == NULL) break; c.imag = _PyFloat_Unpack8(buf, 1); @@ -1074,7 +1076,7 @@ r_object(RFILE *p) case TYPE_STRING: { - char *ptr; + const char *ptr; n = r_long(p); if (PyErr_Occurred()) break; @@ -1119,7 +1121,7 @@ r_object(RFILE *p) } _read_ascii: { - char *ptr; + const char *ptr; ptr = r_string(n, p); if (ptr == NULL) break; @@ -1137,7 +1139,7 @@ r_object(RFILE *p) is_interned = 1; case TYPE_UNICODE: { - char *buffer; + const char *buffer; n = r_long(p); if (PyErr_Occurred()) diff -r af0b95fb1c19 Python/modsupport.c --- a/Python/modsupport.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/modsupport.c Mon Dec 21 10:49:49 2015 +0200 @@ -301,7 +301,7 @@ do_mkvalue(const char **p_format, va_lis case 'U': /* XXX deprecated alias */ { PyObject *v; - char *str = va_arg(*p_va, char *); + const char *str = va_arg(*p_va, const char *); Py_ssize_t n; if (**p_format == '#') { ++*p_format; @@ -334,7 +334,7 @@ do_mkvalue(const char **p_format, va_lis case 'y': { PyObject *v; - char *str = va_arg(*p_va, char *); + const char *str = va_arg(*p_va, const char *); Py_ssize_t n; if (**p_format == '#') { ++*p_format; diff -r af0b95fb1c19 Python/pylifecycle.c --- a/Python/pylifecycle.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/pylifecycle.c Mon Dec 21 10:49:49 2015 +0200 @@ -1004,8 +1004,8 @@ is_valid_fd(int fd) /* returns Py_None if the fd is not valid */ static PyObject* create_stdio(PyObject* io, - int fd, int write_mode, char* name, - char* encoding, char* errors) + int fd, int write_mode, const char* name, + const char* encoding, const char* errors) { PyObject *buf = NULL, *stream = NULL, *text = NULL, *raw = NULL, *res; const char* mode; diff -r af0b95fb1c19 Python/pystrtod.c --- a/Python/pystrtod.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/pystrtod.c Mon Dec 21 10:49:49 2015 +0200 @@ -881,12 +881,12 @@ PyAPI_FUNC(char *) PyOS_double_to_string #define OFS_E 2 /* The lengths of these are known to the code below, so don't change them */ -static char *lc_float_strings[] = { +static const char * const lc_float_strings[] = { "inf", "nan", "e", }; -static char *uc_float_strings[] = { +static const char * const uc_float_strings[] = { "INF", "NAN", "E", @@ -925,7 +925,8 @@ static char * format_float_short(double d, char format_code, int mode, int precision, int always_add_sign, int add_dot_0_if_integer, - int use_alt_formatting, char **float_strings, int *type) + int use_alt_formatting, const char * const *float_strings, + int *type) { char *buf = NULL; char *p = NULL; @@ -1176,7 +1177,7 @@ PyAPI_FUNC(char *) PyOS_double_to_string int flags, int *type) { - char **float_strings = lc_float_strings; + const char * const *float_strings = lc_float_strings; int mode; /* Validate format_code, and map upper and lower case. Compute the diff -r af0b95fb1c19 Python/pythonrun.c --- a/Python/pythonrun.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/pythonrun.c Mon Dec 21 10:49:49 2015 +0200 @@ -1138,8 +1138,8 @@ PyParser_ASTFromString(const char *s, co mod_ty PyParser_ASTFromFileObject(FILE *fp, PyObject *filename, const char* enc, - int start, char *ps1, - char *ps2, PyCompilerFlags *flags, int *errcode, + int start, const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena) { mod_ty mod; @@ -1171,8 +1171,8 @@ PyParser_ASTFromFileObject(FILE *fp, PyO mod_ty PyParser_ASTFromFile(FILE *fp, const char *filename_str, const char* enc, - int start, char *ps1, - char *ps2, PyCompilerFlags *flags, int *errcode, + int start, const char *ps1, + const char *ps2, PyCompilerFlags *flags, int *errcode, PyArena *arena) { mod_ty mod; diff -r af0b95fb1c19 Python/symtable.c --- a/Python/symtable.c Sun Dec 20 16:37:21 2015 +0200 +++ b/Python/symtable.c Mon Dec 21 10:49:49 2015 +0200 @@ -160,7 +160,7 @@ PyTypeObject PySTEntry_Type = { }; static int symtable_analyze(struct symtable *st); -static int symtable_warn(struct symtable *st, char *msg, int lineno); +static int symtable_warn(struct symtable *st, const char *msg, int lineno); static int symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block, void *ast, int lineno, int col_offset); @@ -903,7 +903,7 @@ symtable_analyze(struct symtable *st) static int -symtable_warn(struct symtable *st, char *msg, int lineno) +symtable_warn(struct symtable *st, const char *msg, int lineno) { PyObject *message = PyUnicode_FromString(msg); if (message == NULL)