Constify filenames and scripts. Fixes #651362.
diff --git a/Include/compile.h b/Include/compile.h
index a4b2f55..a462d77 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -52,7 +52,7 @@
 
 /* Public interface */
 struct _node; /* Declare the existence of this type */
-PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, char *);
+PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
 PyAPI_FUNC(PyCodeObject *) PyCode_New(
 	int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
 	PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); 
@@ -67,8 +67,8 @@
     int ff_features;
 } PyFutureFeatures;
 
-PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, char *);
-PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *,
+PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *);
+PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *,
 					      PyCompilerFlags *);
 
 #define FUTURE_NESTED_SCOPES "nested_scopes"
diff --git a/Include/parsetok.h b/Include/parsetok.h
index 9bcc1f7..58ef76a 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -9,7 +9,7 @@
 
 typedef struct {
     int error;
-    char *filename;
+    const char *filename;
     int lineno;
     int offset;
     char *text;
@@ -21,19 +21,19 @@
 #define PyPARSE_YIELD_IS_KEYWORD	0x0001
 #endif
 
-PyAPI_FUNC(node *) PyParser_ParseString(char *, grammar *, int,
+PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
                                               perrdetail *);
-PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, char *, grammar *, int,
+PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
                                              char *, char *, perrdetail *);
 
-PyAPI_FUNC(node *) PyParser_ParseStringFlags(char *, grammar *, int,
+PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
                                               perrdetail *, int);
-PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *,
+PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
 						 int, char *, char *,
 						 perrdetail *, int);
 
-PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(char *,
-					      char *,
+PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
+					      const char *,
 					      grammar *, int,
                                               perrdetail *, int);
 #ifdef __cplusplus
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 1adc6ec..a4ab62a 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -130,16 +130,17 @@
 
 /* Issue a warning or exception */
 PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
-PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, char *,
-					 char *, int, char *, PyObject *);
+PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
+				   const char *, int, 
+				   const char *, PyObject *);
 
 /* In sigcheck.c or signalmodule.c */
 PyAPI_FUNC(int) PyErr_CheckSignals(void);
 PyAPI_FUNC(void) PyErr_SetInterrupt(void);
 
 /* Support for adding program text to SyntaxErrors */
-PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int);
-PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int);
+PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
+PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
 
 #ifdef Py_USING_UNICODE
 /* The following functions are used to create and modify unicode
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index 7bc011b..01e0e32 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -26,47 +26,47 @@
 PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
 PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
 
-PyAPI_FUNC(int) PyRun_AnyFile(FILE *, char *);
-PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int);
+PyAPI_FUNC(int) PyRun_AnyFile(FILE *, const char *);
+PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, const char *, int);
 
-PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
 
-PyAPI_FUNC(int) PyRun_SimpleString(char *);
-PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *);
-PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int);
-PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *);
-PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *);
-PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *);
-PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_SimpleString(const char *);
+PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, const char *);
+PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, const char *, int);
+PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, const char *);
+PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
+PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, const char *);
+PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
 
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int);
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int);
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *,
-								  char *,
+PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(const char *, int);
+PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, const char *, int);
+PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int);
+PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
+								  const char *,
 								  int,
 								  int);
-PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *,
+PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
 							int, int);
 
-PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
-PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
-PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int,
+PyAPI_FUNC(PyObject *) PyRun_String(const char *, int, PyObject *, PyObject *);
+PyAPI_FUNC(PyObject *) PyRun_File(FILE *, const char *, int, PyObject *, PyObject *);
+PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, const char *, int,
 				   PyObject *, PyObject *, int);
-PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *,
+PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *,
 					PyCompilerFlags *);
-PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, 
+PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, const char *, int, PyObject *, 
 				      PyObject *, PyCompilerFlags *);
-PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, 
+PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *, 
 					PyObject *, int, PyCompilerFlags *);
 
-PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int);
-PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int,
+PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
+PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
 					    PyCompilerFlags *);
-PyAPI_FUNC(struct symtable *) Py_SymtableString(char *, char *, int);
+PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
 
 PyAPI_FUNC(void) PyErr_Print(void);
 PyAPI_FUNC(void) PyErr_PrintEx(int);
@@ -76,7 +76,7 @@
 
 PyAPI_FUNC(void) Py_Exit(int);
 
-PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, char *);
+PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
 
 /* Bootstrap */
 PyAPI_FUNC(int) Py_Main(int argc, char **argv);
diff --git a/Include/symtable.h b/Include/symtable.h
index 9bf2a2a..301bd30 100644
--- a/Include/symtable.h
+++ b/Include/symtable.h
@@ -20,7 +20,7 @@
 
 struct symtable {
 	int st_pass;             /* pass == 1 or 2 */
-	char *st_filename;       /* name of file being compiled */
+	const char *st_filename; /* name of file being compiled */
 	struct _symtable_entry *st_cur; /* current symbol table entry */
 	PyObject *st_symbols;    /* dictionary of symbol table entries */
         PyObject *st_stack;      /* stack of namespace info */
@@ -57,7 +57,7 @@
 PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *,
 						 char *, int, int);
 
-PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, char *);
+PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, const char *);
 PyAPI_FUNC(void) PySymtable_Free(struct symtable *);