diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-01-05 21:40:08 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-01-05 21:40:08 (GMT) |
commit | 16eff6f77b0df6cb447b41e51c9796d2a3609be8 (patch) | |
tree | 34c534cadd9053d5f19bf62a542c518214de42f5 | |
parent | db519205a2cd89eb43d7622bc3b37b8b8ea8a629 (diff) | |
download | cpython-16eff6f77b0df6cb447b41e51c9796d2a3609be8.zip cpython-16eff6f77b0df6cb447b41e51c9796d2a3609be8.tar.gz cpython-16eff6f77b0df6cb447b41e51c9796d2a3609be8.tar.bz2 |
Initialize err_ret with filename if available. Fixes #498828.
-rw-r--r-- | Parser/parsetok.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c index bdd51f3..ed4fe7b 100644 --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -14,7 +14,7 @@ int Py_TabcheckFlag; /* Forward */ static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int); -static void initerr(perrdetail *err_ret); +static void initerr(perrdetail *err_ret, char* filename); /* Parse input coming from a string. Return error code, print some errors. */ node * @@ -29,7 +29,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start, { struct tok_state *tok; - initerr(err_ret); + initerr(err_ret, NULL); if ((tok = PyTokenizer_FromString(s)) == NULL) { err_ret->error = E_NOMEM; @@ -63,7 +63,7 @@ PyParser_ParseFileFlags(FILE *fp, char *filename, grammar *g, int start, { struct tok_state *tok; - initerr(err_ret); + initerr(err_ret, filename); if ((tok = PyTokenizer_FromFile(fp, ps1, ps2)) == NULL) { err_ret->error = E_NOMEM; @@ -178,10 +178,10 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, } static void -initerr(perrdetail *err_ret) +initerr(perrdetail *err_ret, char* filename) { err_ret->error = E_OK; - err_ret->filename = NULL; + err_ret->filename = filename; err_ret->lineno = 0; err_ret->offset = 0; err_ret->text = NULL; |