@@ -142,7 +142,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
142142 ste -> ste_has_conditional_annotations = 0 ;
143143 ste -> ste_in_conditional_block = 0 ;
144144 ste -> ste_in_try_block = 0 ;
145- ste -> ste_in_with_block = 0 ;
146145 ste -> ste_in_unevaluated_annotation = 0 ;
147146 ste -> ste_annotation_block = NULL ;
148147
@@ -1756,13 +1755,6 @@ symtable_enter_type_param_block(struct symtable *st, identifier name,
17561755#define LEAVE_TRY_BLOCK (ST ) \
17571756 (ST)->st_cur->ste_in_try_block = in_try_block;
17581757
1759- #define ENTER_WITH_BLOCK (ST ) \
1760- int in_with_block = (ST)->st_cur->ste_in_with_block; \
1761- (ST)->st_cur->ste_in_with_block = 1;
1762-
1763- #define LEAVE_WITH_BLOCK (ST ) \
1764- (ST)->st_cur->ste_in_with_block = in_with_block;
1765-
17661758#define ENTER_RECURSIVE () \
17671759if (Py_EnterRecursiveCall(" during compilation")) { \
17681760 return 0; \
@@ -1835,14 +1827,6 @@ check_lazy_import_context(struct symtable *st, stmt_ty s, const char* import_typ
18351827 return 0 ;
18361828 }
18371829
1838- /* Check if inside with block */
1839- if (st -> st_cur -> ste_in_with_block ) {
1840- PyErr_Format (PyExc_SyntaxError ,
1841- "lazy %s not allowed inside with blocks" , import_type );
1842- SET_ERROR_LOCATION (st -> st_filename , LOCATION (s ));
1843- return 0 ;
1844- }
1845-
18461830 /* Check if inside function scope */
18471831 if (st -> st_cur -> ste_type == FunctionBlock ) {
18481832 PyErr_Format (PyExc_SyntaxError ,
@@ -2258,10 +2242,8 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
22582242 break ;
22592243 case With_kind : {
22602244 ENTER_CONDITIONAL_BLOCK (st );
2261- ENTER_WITH_BLOCK (st );
22622245 VISIT_SEQ (st , withitem , s -> v .With .items );
22632246 VISIT_SEQ (st , stmt , s -> v .With .body );
2264- LEAVE_WITH_BLOCK (st );
22652247 LEAVE_CONDITIONAL_BLOCK (st );
22662248 break ;
22672249 }
@@ -2326,10 +2308,8 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
23262308 return 0 ;
23272309 }
23282310 ENTER_CONDITIONAL_BLOCK (st );
2329- ENTER_WITH_BLOCK (st );
23302311 VISIT_SEQ (st , withitem , s -> v .AsyncWith .items );
23312312 VISIT_SEQ (st , stmt , s -> v .AsyncWith .body );
2332- LEAVE_WITH_BLOCK (st );
23332313 LEAVE_CONDITIONAL_BLOCK (st );
23342314 break ;
23352315 }
0 commit comments