Index: Python/errors.c =================================================================== --- Python/errors.c (revision 68609) +++ Python/errors.c (working copy) @@ -357,7 +357,7 @@ PyObject * -PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) +PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) { PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); @@ -367,7 +367,7 @@ #ifdef Py_WIN_WIDE_FILENAMES PyObject * -PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename) +PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) { PyObject *name = filename ? PyUnicode_FromUnicode(filename, wcslen(filename)) : @@ -503,7 +503,7 @@ #endif /* MS_WINDOWS */ void -_PyErr_BadInternalCall(char *filename, int lineno) +_PyErr_BadInternalCall(const char *filename, int lineno) { PyErr_Format(PyExc_SystemError, "%s:%d: bad argument to internal function", @@ -545,9 +545,9 @@ PyObject * -PyErr_NewException(char *name, PyObject *base, PyObject *dict) +PyErr_NewException(const char *name, PyObject *base, PyObject *dict) { - char *dot; + const char *dot; PyObject *modulename = NULL; PyObject *classname = NULL; PyObject *mydict = NULL; Index: Include/pyerrors.h =================================================================== --- Include/pyerrors.h (revision 68609) +++ Include/pyerrors.h (working copy) @@ -185,10 +185,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, const char*); #ifdef Py_WIN_WIDE_FILENAMES PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, Py_UNICODE *); + PyObject *, const Py_UNICODE *); #endif /* Py_WIN_WIDE_FILENAMES */ PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) @@ -217,13 +217,13 @@ /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); -PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno); +PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) /* Function to create a new exception */ -PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base, +PyAPI_FUNC(PyObject *) PyErr_NewException(const char *name, PyObject *base, PyObject *dict); PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); Index: Doc/c-api/exceptions.rst =================================================================== --- Doc/c-api/exceptions.rst (revision 68609) +++ Doc/c-api/exceptions.rst (working copy) @@ -272,7 +272,7 @@ :exc:`WindowsError` as a third parameter. Availability: Windows. -.. cfunction:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename) +.. cfunction:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, const char *filename) Similar to :cfunc:`PyErr_SetFromWindowsErrWithFilename`, with an additional parameter specifying the exception type to be raised. Availability: Windows. @@ -287,7 +287,7 @@ was invoked with an illegal argument. It is mostly for internal use. -.. cfunction:: int PyErr_WarnEx(PyObject *category, char *message, int stacklevel) +.. cfunction:: int PyErr_WarnEx(PyObject *category, const char *message, int stacklevel) Issue a warning message. The *category* argument is a warning category (see below) or *NULL*; the *message* argument is a message string. *stacklevel* is a @@ -324,7 +324,7 @@ documentation. There is no C API for warning control. -.. cfunction:: int PyErr_Warn(PyObject *category, char *message) +.. cfunction:: int PyErr_Warn(PyObject *category, const char *message) Issue a warning message. The *category* argument is a warning category (see below) or *NULL*; the *message* argument is a message string. The warning will @@ -343,7 +343,7 @@ described there. -.. cfunction:: int PyErr_WarnPy3k(char *message, int stacklevel) +.. cfunction:: int PyErr_WarnPy3k(const char *message, int stacklevel) Issue a :exc:`DeprecationWarning` with the given *message* and *stacklevel* if the :cdata:`Py_Py3kWarningFlag` flag is enabled. @@ -392,7 +392,7 @@ only be called from the main thread. -.. cfunction:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) +.. cfunction:: PyObject* PyErr_NewException(const char *name, PyObject *base, PyObject *dict) This utility function creates and returns a new exception object. The *name* argument must be the name of the new exception, a C string of the form