diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 3c339f000e..30275a6d40 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -191,6 +191,10 @@ PyAST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename, if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) { c.c_encoding = "utf-8"; + if (TYPE(n) == encoding_decl) { + ast_error(n, "encoding declaration in Unicode string"); + goto error; + } } else if (TYPE(n) == encoding_decl) { c.c_encoding = STR(n); n = CHILD(n, 0); |