diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-08-04 17:29:52 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-08-04 17:29:52 +0000 |
commit | 00f1e3f5a54adb0a7159a446edeca2e36da4092e (patch) | |
tree | 86d731c4fd7c0141686044f5eefbb7f475da9647 /Parser/parsetok.c | |
parent | a729daf2e43f3ffa2d1b3b6cd31491c840091e66 (diff) | |
download | cpython-git-00f1e3f5a54adb0a7159a446edeca2e36da4092e.tar.gz |
Patch #534304: Implement phase 1 of PEP 263.
Diffstat (limited to 'Parser/parsetok.c')
-rw-r--r-- | Parser/parsetok.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c index 5758fa749b..d70e2d64f8 100644 --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -8,6 +8,7 @@ #include "parser.h" #include "parsetok.h" #include "errcode.h" +#include "graminit.h" int Py_TabcheckFlag; @@ -45,8 +46,8 @@ PyParser_ParseStringFlagsFilename(char *s, char *filename, return NULL; } + tok->filename = filename ? filename : "<string>"; if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->filename = filename ? filename : "<string>"; tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) tok->alterror++; @@ -78,8 +79,8 @@ PyParser_ParseFileFlags(FILE *fp, char *filename, grammar *g, int start, err_ret->error = E_NOMEM; return NULL; } + tok->filename = filename; if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->filename = filename; tok->altwarning = (filename != NULL); if (Py_TabcheckFlag >= 2) tok->alterror++; @@ -185,6 +186,13 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, err_ret->text[len] = '\0'; } } + } else if (tok->encoding != NULL) { + node* r = PyNode_New(encoding_decl); + r->n_str = tok->encoding; + r->n_nchildren = 1; + r->n_child = n; + tok->encoding = NULL; + n = r; } PyTokenizer_Free(tok); |