File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ typedef struct _symtable_entry {
4646 int ste_nested ; /* true if scope is nested */
4747 int ste_child_free ; /* true if a child scope has free variables,
4848 including free refs to globals */
49+ int ste_opt_lineno ; /* lineno of last exec or import * */
4950 struct symtable * ste_table ;
5051} PySymtableEntryObject ;
5152
Original file line number Diff line number Diff line change @@ -4241,7 +4241,7 @@ symtable_check_unoptimized(struct compiling *c,
42414241 if (c -> c_symtable -> st_nested_scopes ) {
42424242 PyErr_SetString (PyExc_SyntaxError , buf );
42434243 PyErr_SyntaxLocation (c -> c_symtable -> st_filename ,
4244- ste -> ste_lineno );
4244+ ste -> ste_opt_lineno );
42454245 return -1 ;
42464246 }
42474247 else {
@@ -4820,8 +4820,10 @@ symtable_node(struct symtable *st, node *n)
48204820 symtable_node (st , CHILD (n , 1 ));
48214821 if (NCH (n ) > 2 )
48224822 symtable_node (st , CHILD (n , 3 ));
4823- else
4823+ else {
48244824 st -> st_cur -> ste_optimized |= OPT_BARE_EXEC ;
4825+ st -> st_cur -> ste_opt_lineno = n -> n_lineno ;
4826+ }
48254827 if (NCH (n ) > 4 )
48264828 symtable_node (st , CHILD (n , 5 ));
48274829 break ;
@@ -5106,6 +5108,7 @@ symtable_import(struct symtable *st, node *n)
51065108 }
51075109 if (TYPE (CHILD (n , 3 )) == STAR ) {
51085110 st -> st_cur -> ste_optimized |= OPT_IMPORT_STAR ;
5111+ st -> st_cur -> ste_opt_lineno = n -> n_lineno ;
51095112 } else {
51105113 for (i = 3 ; i < NCH (n ); i += 2 ) {
51115114 node * c = CHILD (n , i );
You can’t perform that action at this time.
0 commit comments