Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 26601:cc05c2c8660e legacy-trunk
Constify filenames and scripts. Fixes #651362.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 11 Dec 2002 14:04:59 +0000 |
| parents | 90e9a3ecda44 |
| children | 1312297887a3 |
line wrap: on
line diff
--- a/Python/compile.c Wed Dec 11 13:54:20 2002 +0000 +++ b/Python/compile.c Wed Dec 11 14:04:59 2002 +0000 @@ -472,7 +472,7 @@ int c_begin; /* begin of current loop, for 'continue' */ int c_block[CO_MAXBLOCKS]; /* stack of block types */ 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) */ int c_lineno; /* Current line number */ int c_stacklevel; /* Current stack level */ @@ -574,8 +574,8 @@ /* Prototype forward declarations */ -static int issue_warning(char *, char *, int); -static int com_init(struct compiling *, char *); +static int issue_warning(const char *, const char *, int); +static int com_init(struct compiling *, const char *); static void com_free(struct compiling *); static void com_push(struct compiling *, int); static void com_pop(struct compiling *, int); @@ -597,7 +597,7 @@ static void com_assign(struct compiling *, node *, int, node *); static void com_assign_name(struct compiling *, node *, int); static PyCodeObject *icompile(node *, struct compiling *); -static PyCodeObject *jcompile(node *, char *, struct compiling *, +static PyCodeObject *jcompile(node *, const char *, struct compiling *, PyCompilerFlags *); static PyObject *parsestrplus(struct compiling*, node *); static PyObject *parsestr(struct compiling *, char *); @@ -654,7 +654,7 @@ #define DUMP(N) dump(N, 0, -1) static int -com_init(struct compiling *c, char *filename) +com_init(struct compiling *c, const char *filename) { memset((void *)c, '\0', sizeof(struct compiling)); if ((c->c_code = PyString_FromStringAndSize((char *)NULL, @@ -1182,7 +1182,9 @@ "hex/oct constants > sys.maxint " "will return positive values " "in Python 2.4 and up", - c->c_filename, + /* XXX: Give WarnExplicit + a const char* argument. */ + (char*)c->c_filename, c->c_lineno, NULL, NULL) < 0) @@ -4142,19 +4144,19 @@ } PyCodeObject * -PyNode_Compile(node *n, char *filename) +PyNode_Compile(node *n, const char *filename) { return PyNode_CompileFlags(n, filename, NULL); } PyCodeObject * -PyNode_CompileFlags(node *n, char *filename, PyCompilerFlags *flags) +PyNode_CompileFlags(node *n, const char *filename, PyCompilerFlags *flags) { return jcompile(n, filename, NULL, flags); } struct symtable * -PyNode_CompileSymtable(node *n, char *filename) +PyNode_CompileSymtable(node *n, const char *filename) { struct symtable *st; PyFutureFeatures *ff; @@ -4191,7 +4193,7 @@ } static PyCodeObject * -jcompile(node *n, char *filename, struct compiling *base, +jcompile(node *n, const char *filename, struct compiling *base, PyCompilerFlags *flags) { struct compiling sc; @@ -4351,7 +4353,7 @@ /* Helper functions to issue warnings */ 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, lineno, NULL, NULL) < 0) {
