diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-12-12 01:24:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 01:24:12 (GMT) |
commit | 438817fdd5b731d486285d205bed2e78b655c0d6 (patch) | |
tree | baee17de51ea0d5c3400f22dcf6ec52fb951af29 /Include/internal | |
parent | 991736697dff693b6c9f8964bb7540081bbf4ddb (diff) | |
download | cpython-438817fdd5b731d486285d205bed2e78b655c0d6.zip cpython-438817fdd5b731d486285d205bed2e78b655c0d6.tar.gz cpython-438817fdd5b731d486285d205bed2e78b655c0d6.tar.bz2 |
bpo-46042: Improve SyntaxError locations in the symbol table (GH-30059) (GH-30064)
(cherry picked from commit 59435eea08d30796174552c0ca03c59b41adf8a5)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_symtable.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Include/internal/pycore_symtable.h b/Include/internal/pycore_symtable.h index f3505f8..a2e520b 100644 --- a/Include/internal/pycore_symtable.h +++ b/Include/internal/pycore_symtable.h @@ -13,6 +13,13 @@ struct _mod; // Type defined in pycore_ast.h typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock, AnnotationBlock } _Py_block_ty; +typedef enum _comprehension_type { + NoComprehension = 0, + ListComprehension = 1, + DictComprehension = 2, + SetComprehension = 3, + GeneratorExpression = 4 } _Py_comprehension_ty; + struct _symtable_entry; struct symtable { @@ -42,14 +49,14 @@ typedef struct _symtable_entry { PyObject *ste_varnames; /* list of function parameters */ PyObject *ste_children; /* list of child blocks */ PyObject *ste_directives;/* locations of global and nonlocal statements */ - _Py_block_ty ste_type; /* module, class, or function */ + _Py_block_ty ste_type; /* module, class or function */ int ste_nested; /* true if block is nested */ unsigned ste_free : 1; /* true if block has free variables */ unsigned ste_child_free : 1; /* true if a child block has free vars, including free refs to globals */ unsigned ste_generator : 1; /* true if namespace is a generator */ unsigned ste_coroutine : 1; /* true if namespace is a coroutine */ - unsigned ste_comprehension : 1; /* true if namespace is a list comprehension */ + _Py_comprehension_ty ste_comprehension; /* Kind of comprehension (if any) */ unsigned ste_varargs : 1; /* true if block has varargs */ unsigned ste_varkeywords : 1; /* true if block has varkeywords */ unsigned ste_returns_value : 1; /* true if namespace uses return with |