Kaydet (Commit) 95292d6c authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Constify filenames and scripts. Fixes #651362.

üst 0e88c9f6
...@@ -52,7 +52,7 @@ PyAPI_DATA(PyTypeObject) PyCode_Type; ...@@ -52,7 +52,7 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
/* Public interface */ /* Public interface */
struct _node; /* Declare the existence of this type */ 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( PyAPI_FUNC(PyCodeObject *) PyCode_New(
int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
...@@ -67,8 +67,8 @@ typedef struct { ...@@ -67,8 +67,8 @@ typedef struct {
int ff_features; int ff_features;
} PyFutureFeatures; } PyFutureFeatures;
PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, char *); PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *);
PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *,
PyCompilerFlags *); PyCompilerFlags *);
#define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_NESTED_SCOPES "nested_scopes"
......
...@@ -9,7 +9,7 @@ extern "C" { ...@@ -9,7 +9,7 @@ extern "C" {
typedef struct { typedef struct {
int error; int error;
char *filename; const char *filename;
int lineno; int lineno;
int offset; int offset;
char *text; char *text;
...@@ -21,19 +21,19 @@ typedef struct { ...@@ -21,19 +21,19 @@ typedef struct {
#define PyPARSE_YIELD_IS_KEYWORD 0x0001 #define PyPARSE_YIELD_IS_KEYWORD 0x0001
#endif #endif
PyAPI_FUNC(node *) PyParser_ParseString(char *, grammar *, int, PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
perrdetail *); perrdetail *);
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, char *, grammar *, int, PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
char *, char *, perrdetail *); char *, char *, perrdetail *);
PyAPI_FUNC(node *) PyParser_ParseStringFlags(char *, grammar *, int, PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
perrdetail *, int); perrdetail *, int);
PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *,
int, char *, char *, int, char *, char *,
perrdetail *, int); perrdetail *, int);
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(char *, PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
char *, const char *,
grammar *, int, grammar *, int,
perrdetail *, int); perrdetail *, int);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -130,16 +130,17 @@ PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); ...@@ -130,16 +130,17 @@ PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
/* Issue a warning or exception */ /* Issue a warning or exception */
PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *); PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, char *, PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
char *, int, char *, PyObject *); const char *, int,
const char *, PyObject *);
/* In sigcheck.c or signalmodule.c */ /* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void); PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void); PyAPI_FUNC(void) PyErr_SetInterrupt(void);
/* Support for adding program text to SyntaxErrors */ /* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int); PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int); PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
#ifdef Py_USING_UNICODE #ifdef Py_USING_UNICODE
/* The following functions are used to create and modify unicode /* The following functions are used to create and modify unicode
......
...@@ -26,47 +26,47 @@ PyAPI_FUNC(int) Py_IsInitialized(void); ...@@ -26,47 +26,47 @@ PyAPI_FUNC(int) Py_IsInitialized(void);
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
PyAPI_FUNC(int) PyRun_AnyFile(FILE *, char *); PyAPI_FUNC(int) PyRun_AnyFile(FILE *, const char *);
PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int); PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, const char *, int);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleString(char *); PyAPI_FUNC(int) PyRun_SimpleString(const char *);
PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *); PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, const char *);
PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int); PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, const char *, int);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *); PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, const char *);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *); PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, const char *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int); PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(const char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, const char *, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
char *, const char *,
int, int,
int); int);
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
int, int); int, int);
PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyRun_String(const char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyRun_File(FILE *, const char *, int, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int, PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, const char *, int,
PyObject *, PyObject *, int); PyObject *, PyObject *, int);
PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *,
PyCompilerFlags *); PyCompilerFlags *);
PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, const char *, int, PyObject *,
PyObject *, PyCompilerFlags *); PyObject *, PyCompilerFlags *);
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *,
PyObject *, int, PyCompilerFlags *); PyObject *, int, PyCompilerFlags *);
PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int); PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int, PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
PyCompilerFlags *); 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_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int); PyAPI_FUNC(void) PyErr_PrintEx(int);
...@@ -76,7 +76,7 @@ PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); ...@@ -76,7 +76,7 @@ PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC(void) Py_Exit(int); PyAPI_FUNC(void) Py_Exit(int);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, char *); PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
/* Bootstrap */ /* Bootstrap */
PyAPI_FUNC(int) Py_Main(int argc, char **argv); PyAPI_FUNC(int) Py_Main(int argc, char **argv);
......
...@@ -20,7 +20,7 @@ struct _symtable_entry; ...@@ -20,7 +20,7 @@ struct _symtable_entry;
struct symtable { struct symtable {
int st_pass; /* pass == 1 or 2 */ 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 */ struct _symtable_entry *st_cur; /* current symbol table entry */
PyObject *st_symbols; /* dictionary of symbol table entries */ PyObject *st_symbols; /* dictionary of symbol table entries */
PyObject *st_stack; /* stack of namespace info */ PyObject *st_stack; /* stack of namespace info */
...@@ -57,7 +57,7 @@ PyAPI_DATA(PyTypeObject) PySymtableEntry_Type; ...@@ -57,7 +57,7 @@ PyAPI_DATA(PyTypeObject) PySymtableEntry_Type;
PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *, PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *,
char *, int, int); 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 *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
......
...@@ -15,17 +15,17 @@ int Py_TabcheckFlag; ...@@ -15,17 +15,17 @@ int Py_TabcheckFlag;
/* Forward */ /* Forward */
static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int); static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int);
static void initerr(perrdetail *err_ret, char* filename); static void initerr(perrdetail *err_ret, const char* filename);
/* Parse input coming from a string. Return error code, print some errors. */ /* Parse input coming from a string. Return error code, print some errors. */
node * node *
PyParser_ParseString(char *s, grammar *g, int start, perrdetail *err_ret) PyParser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret)
{ {
return PyParser_ParseStringFlags(s, g, start, err_ret, 0); return PyParser_ParseStringFlags(s, g, start, err_ret, 0);
} }
node * node *
PyParser_ParseStringFlags(char *s, grammar *g, int start, PyParser_ParseStringFlags(const char *s, grammar *g, int start,
perrdetail *err_ret, int flags) perrdetail *err_ret, int flags)
{ {
return PyParser_ParseStringFlagsFilename(s, NULL, return PyParser_ParseStringFlagsFilename(s, NULL,
...@@ -33,7 +33,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start, ...@@ -33,7 +33,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start,
} }
node * node *
PyParser_ParseStringFlagsFilename(char *s, char *filename, PyParser_ParseStringFlagsFilename(const char *s, const char *filename,
grammar *g, int start, grammar *g, int start,
perrdetail *err_ret, int flags) perrdetail *err_ret, int flags)
{ {
...@@ -60,7 +60,7 @@ PyParser_ParseStringFlagsFilename(char *s, char *filename, ...@@ -60,7 +60,7 @@ PyParser_ParseStringFlagsFilename(char *s, char *filename,
/* Parse input coming from a file. Return error code, print some errors. */ /* Parse input coming from a file. Return error code, print some errors. */
node * node *
PyParser_ParseFile(FILE *fp, char *filename, grammar *g, int start, PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start,
char *ps1, char *ps2, perrdetail *err_ret) char *ps1, char *ps2, perrdetail *err_ret)
{ {
return PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2, return PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2,
...@@ -68,7 +68,7 @@ PyParser_ParseFile(FILE *fp, char *filename, grammar *g, int start, ...@@ -68,7 +68,7 @@ PyParser_ParseFile(FILE *fp, char *filename, grammar *g, int start,
} }
node * node *
PyParser_ParseFileFlags(FILE *fp, char *filename, grammar *g, int start, PyParser_ParseFileFlags(FILE *fp, const char *filename, grammar *g, int start,
char *ps1, char *ps2, perrdetail *err_ret, int flags) char *ps1, char *ps2, perrdetail *err_ret, int flags)
{ {
struct tok_state *tok; struct tok_state *tok;
...@@ -201,7 +201,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, ...@@ -201,7 +201,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
} }
static void static void
initerr(perrdetail *err_ret, char* filename) initerr(perrdetail *err_ret, const char* filename)
{ {
err_ret->error = E_OK; err_ret->error = E_OK;
err_ret->filename = filename; err_ret->filename = filename;
......
...@@ -386,7 +386,8 @@ fp_setreadl(struct tok_state *tok, const char* enc) ...@@ -386,7 +386,8 @@ fp_setreadl(struct tok_state *tok, const char* enc)
{ {
PyObject *reader, *stream, *readline; PyObject *reader, *stream, *readline;
stream = PyFile_FromFile(tok->fp, tok->filename, "rb", NULL); /* XXX: constify filename argument. */
stream = PyFile_FromFile(tok->fp, (char*)tok->filename, "rb", NULL);
if (stream == NULL) if (stream == NULL)
return 0; return 0;
...@@ -591,7 +592,7 @@ decode_str(const char *str, struct tok_state *tok) ...@@ -591,7 +592,7 @@ decode_str(const char *str, struct tok_state *tok)
/* Set up tokenizer for string */ /* Set up tokenizer for string */
struct tok_state * struct tok_state *
PyTokenizer_FromString(char *str) PyTokenizer_FromString(const char *str)
{ {
struct tok_state *tok = tok_new(); struct tok_state *tok = tok_new();
if (tok == NULL) if (tok == NULL)
...@@ -599,7 +600,8 @@ PyTokenizer_FromString(char *str) ...@@ -599,7 +600,8 @@ PyTokenizer_FromString(char *str)
str = (char *)decode_str(str, tok); str = (char *)decode_str(str, tok);
if (str == NULL) if (str == NULL)
return NULL; return NULL;
tok->buf = tok->cur = tok->end = tok->inp = str; /* XXX: constify members. */
tok->buf = tok->cur = tok->end = tok->inp = (char*)str;
return tok; return tok;
} }
......
...@@ -34,7 +34,7 @@ struct tok_state { ...@@ -34,7 +34,7 @@ struct tok_state {
int level; /* () [] {} Parentheses nesting level */ int level; /* () [] {} Parentheses nesting level */
/* Used to allow free continuations inside them */ /* Used to allow free continuations inside them */
/* Stuff for checking on different tab sizes */ /* Stuff for checking on different tab sizes */
char *filename; /* For error messages */ const char *filename; /* For error messages */
int altwarning; /* Issue warning if alternate tabs don't match */ int altwarning; /* Issue warning if alternate tabs don't match */
int alterror; /* Issue error if alternate tabs don't match */ int alterror; /* Issue error if alternate tabs don't match */
int alttabsize; /* Alternate tab spacing */ int alttabsize; /* Alternate tab spacing */
...@@ -54,7 +54,7 @@ struct tok_state { ...@@ -54,7 +54,7 @@ struct tok_state {
const char* str; const char* str;
}; };
extern struct tok_state *PyTokenizer_FromString(char *); extern struct tok_state *PyTokenizer_FromString(const char *);
extern struct tok_state *PyTokenizer_FromFile(FILE *, char *, char *); extern struct tok_state *PyTokenizer_FromFile(FILE *, char *, char *);
extern void PyTokenizer_Free(struct tok_state *); extern void PyTokenizer_Free(struct tok_state *);
extern int PyTokenizer_Get(struct tok_state *, char **, char **); extern int PyTokenizer_Get(struct tok_state *, char **, char **);
......
...@@ -472,7 +472,7 @@ struct compiling { ...@@ -472,7 +472,7 @@ struct compiling {
int c_begin; /* begin of current loop, for 'continue' */ int c_begin; /* begin of current loop, for 'continue' */
int c_block[CO_MAXBLOCKS]; /* stack of block types */ int c_block[CO_MAXBLOCKS]; /* stack of block types */
int c_nblocks; /* current block stack level */ int c_nblocks; /* current block stack level */
char *c_filename; /* filename of current node */ const char *c_filename; /* filename of current node */
char *c_name; /* name of object (e.g. function) */ char *c_name; /* name of object (e.g. function) */
int c_lineno; /* Current line number */ int c_lineno; /* Current line number */
int c_stacklevel; /* Current stack level */ int c_stacklevel; /* Current stack level */
...@@ -574,8 +574,8 @@ block_pop(struct compiling *c, int type) ...@@ -574,8 +574,8 @@ block_pop(struct compiling *c, int type)
/* Prototype forward declarations */ /* Prototype forward declarations */
static int issue_warning(char *, char *, int); static int issue_warning(const char *, const char *, int);
static int com_init(struct compiling *, char *); static int com_init(struct compiling *, const char *);
static void com_free(struct compiling *); static void com_free(struct compiling *);
static void com_push(struct compiling *, int); static void com_push(struct compiling *, int);
static void com_pop(struct compiling *, int); static void com_pop(struct compiling *, int);
...@@ -597,7 +597,7 @@ static int com_argdefs(struct compiling *, node *); ...@@ -597,7 +597,7 @@ static int com_argdefs(struct compiling *, node *);
static void com_assign(struct compiling *, node *, int, node *); static void com_assign(struct compiling *, node *, int, node *);
static void com_assign_name(struct compiling *, node *, int); static void com_assign_name(struct compiling *, node *, int);
static PyCodeObject *icompile(node *, struct compiling *); static PyCodeObject *icompile(node *, struct compiling *);
static PyCodeObject *jcompile(node *, char *, struct compiling *, static PyCodeObject *jcompile(node *, const char *, struct compiling *,
PyCompilerFlags *); PyCompilerFlags *);
static PyObject *parsestrplus(struct compiling*, node *); static PyObject *parsestrplus(struct compiling*, node *);
static PyObject *parsestr(struct compiling *, char *); static PyObject *parsestr(struct compiling *, char *);
...@@ -654,7 +654,7 @@ dump(node *n, int pad, int depth) ...@@ -654,7 +654,7 @@ dump(node *n, int pad, int depth)
#define DUMP(N) dump(N, 0, -1) #define DUMP(N) dump(N, 0, -1)
static int static int
com_init(struct compiling *c, char *filename) com_init(struct compiling *c, const char *filename)
{ {
memset((void *)c, '\0', sizeof(struct compiling)); memset((void *)c, '\0', sizeof(struct compiling));
if ((c->c_code = PyString_FromStringAndSize((char *)NULL, if ((c->c_code = PyString_FromStringAndSize((char *)NULL,
...@@ -1182,7 +1182,9 @@ parsenumber(struct compiling *c, char *s) ...@@ -1182,7 +1182,9 @@ parsenumber(struct compiling *c, char *s)
"hex/oct constants > sys.maxint " "hex/oct constants > sys.maxint "
"will return positive values " "will return positive values "
"in Python 2.4 and up", "in Python 2.4 and up",
c->c_filename, /* XXX: Give WarnExplicit
a const char* argument. */
(char*)c->c_filename,
c->c_lineno, c->c_lineno,
NULL, NULL,
NULL) < 0) NULL) < 0)
...@@ -4142,19 +4144,19 @@ dict_keys_inorder(PyObject *dict, int offset) ...@@ -4142,19 +4144,19 @@ dict_keys_inorder(PyObject *dict, int offset)
} }
PyCodeObject * PyCodeObject *
PyNode_Compile(node *n, char *filename) PyNode_Compile(node *n, const char *filename)
{ {
return PyNode_CompileFlags(n, filename, NULL); return PyNode_CompileFlags(n, filename, NULL);
} }
PyCodeObject * PyCodeObject *
PyNode_CompileFlags(node *n, char *filename, PyCompilerFlags *flags) PyNode_CompileFlags(node *n, const char *filename, PyCompilerFlags *flags)
{ {
return jcompile(n, filename, NULL, flags); return jcompile(n, filename, NULL, flags);
} }
struct symtable * struct symtable *
PyNode_CompileSymtable(node *n, char *filename) PyNode_CompileSymtable(node *n, const char *filename)
{ {
struct symtable *st; struct symtable *st;
PyFutureFeatures *ff; PyFutureFeatures *ff;
...@@ -4191,7 +4193,7 @@ icompile(node *n, struct compiling *base) ...@@ -4191,7 +4193,7 @@ icompile(node *n, struct compiling *base)
} }
static PyCodeObject * static PyCodeObject *
jcompile(node *n, char *filename, struct compiling *base, jcompile(node *n, const char *filename, struct compiling *base,
PyCompilerFlags *flags) PyCompilerFlags *flags)
{ {
struct compiling sc; struct compiling sc;
...@@ -4351,7 +4353,7 @@ get_ref_type(struct compiling *c, char *name) ...@@ -4351,7 +4353,7 @@ get_ref_type(struct compiling *c, char *name)
/* Helper functions to issue warnings */ /* Helper functions to issue warnings */
static int static int
issue_warning(char *msg, char *filename, int lineno) issue_warning(const char *msg, const char *filename, int lineno)
{ {
if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, filename, if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, filename,
lineno, NULL, NULL) < 0) { lineno, NULL, NULL) < 0) {
......
...@@ -637,9 +637,9 @@ PyErr_Warn(PyObject *category, char *message) ...@@ -637,9 +637,9 @@ PyErr_Warn(PyObject *category, char *message)
/* Warning with explicit origin */ /* Warning with explicit origin */
int int
PyErr_WarnExplicit(PyObject *category, char *message, PyErr_WarnExplicit(PyObject *category, const char *message,
char *filename, int lineno, const char *filename, int lineno,
char *module, PyObject *registry) const char *module, PyObject *registry)
{ {
PyObject *mod, *dict, *func = NULL; PyObject *mod, *dict, *func = NULL;
...@@ -679,7 +679,7 @@ PyErr_WarnExplicit(PyObject *category, char *message, ...@@ -679,7 +679,7 @@ PyErr_WarnExplicit(PyObject *category, char *message,
to make printing of exceptions believe it is a syntax error. */ to make printing of exceptions believe it is a syntax error. */
void void
PyErr_SyntaxLocation(char *filename, int lineno) PyErr_SyntaxLocation(const char *filename, int lineno)
{ {
PyObject *exc, *v, *tb, *tmp; PyObject *exc, *v, *tb, *tmp;
...@@ -743,7 +743,7 @@ PyErr_SyntaxLocation(char *filename, int lineno) ...@@ -743,7 +743,7 @@ PyErr_SyntaxLocation(char *filename, int lineno)
*/ */
PyObject * PyObject *
PyErr_ProgramText(char *filename, int lineno) PyErr_ProgramText(const char *filename, int lineno)
{ {
FILE *fp; FILE *fp;
int i; int i;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define FUTURE_POSSIBLE(FF) ((FF)->ff_last_lineno == -1) #define FUTURE_POSSIBLE(FF) ((FF)->ff_last_lineno == -1)
static int static int
future_check_features(PyFutureFeatures *ff, node *n, char *filename) future_check_features(PyFutureFeatures *ff, node *n, const char *filename)
{ {
int i; int i;
char *feature; char *feature;
...@@ -54,7 +54,7 @@ future_check_features(PyFutureFeatures *ff, node *n, char *filename) ...@@ -54,7 +54,7 @@ future_check_features(PyFutureFeatures *ff, node *n, char *filename)
} }
static void static void
future_error(node *n, char *filename) future_error(node *n, const char *filename)
{ {
PyErr_SetString(PyExc_SyntaxError, PyErr_SetString(PyExc_SyntaxError,
"from __future__ imports must occur at the " "from __future__ imports must occur at the "
...@@ -89,7 +89,7 @@ dotted_name: NAME ('.' NAME)* ...@@ -89,7 +89,7 @@ dotted_name: NAME ('.' NAME)*
*/ */
static int static int
future_parse(PyFutureFeatures *ff, node *n, char *filename) future_parse(PyFutureFeatures *ff, node *n, const char *filename)
{ {
int i, r; int i, r;
loop: loop:
...@@ -240,7 +240,7 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename) ...@@ -240,7 +240,7 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
} }
PyFutureFeatures * PyFutureFeatures *
PyNode_Future(node *n, char *filename) PyNode_Future(node *n, const char *filename)
{ {
PyFutureFeatures *ff; PyFutureFeatures *ff;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment