mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-46042: Improve SyntaxError locations in the symbol table (GH-30059)
This commit is contained in:
parent
e029c53e1a
commit
59435eea08
4 changed files with 98 additions and 65 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue