From 16eff6f77b0df6cb447b41e51c9796d2a3609be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 5 Jan 2002 21:40:08 +0000 Subject: [PATCH] Initialize err_ret with filename if available. Fixes #498828. --- Parser/parsetok.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Parser/parsetok.c b/Parser/parsetok.c index bdd51f380bf..ed4fe7b760f 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;