diff options
author | Thomas Heller <theller@ctypes.org> | 2002-07-09 09:23:27 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2002-07-09 09:23:27 (GMT) |
commit | 6b17abf6c0ddaed423a76e665124a80afbc39fe7 (patch) | |
tree | 2ac5bf135de125db8dc0d2cf942a9cd554fcde3d /Parser/parsetok.c | |
parent | 4254cbd29c77f3d26d701198735957375a995dcc (diff) | |
download | cpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.zip cpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.tar.gz cpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.tar.bz2 |
Fix SF Bug 564931: compile() traceback must include filename.
Diffstat (limited to 'Parser/parsetok.c')
-rw-r--r-- | Parser/parsetok.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c index 472b0f5..cd3887d 100644 --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -27,9 +27,18 @@ node * PyParser_ParseStringFlags(char *s, grammar *g, int start, perrdetail *err_ret, int flags) { + return PyParser_ParseStringFlagsFilename(s, NULL, + g, start, err_ret, 0); +} + +node * +PyParser_ParseStringFlagsFilename(char *s, char *filename, + grammar *g, int start, + perrdetail *err_ret, int flags) +{ struct tok_state *tok; - initerr(err_ret, NULL); + initerr(err_ret, filename); if ((tok = PyTokenizer_FromString(s)) == NULL) { err_ret->error = E_NOMEM; @@ -37,7 +46,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start, } if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->filename = "<string>"; + tok->filename = filename ? filename : "<string>"; tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) tok->alterror++; |