Python 3.1 "with" statement bug

This commit is contained in:
rocky
2016-10-24 20:47:12 -04:00
parent 6319d33fa0
commit aff920d87b
3 changed files with 9 additions and 1 deletions

Binary file not shown.

View File

@@ -1,4 +1,4 @@
# Python 2.6 has a truly weird way of handling with here.
# Python 2.6 has a truly weird way of handling "with" here.
# added rule for 2.6
# setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP

View File

@@ -698,6 +698,14 @@ class Python31Parser(Python32Parser):
def p_31(self, args):
"""
binary_subscr2 ::= expr expr DUP_TOPX BINARY_SUBSCR
setupwith ::= DUP_TOP LOAD_ATTR store LOAD_ATTR CALL_FUNCTION_0 POP_TOP
withstmt ::= expr setupwith SETUP_FINALLY suite_stmts_opt
POP_BLOCK LOAD_CONST COME_FROM_FINALLY
load del_stmt WITH_CLEANUP END_FINALLY
store ::= STORE_FAST
store ::= STORE_NAME
load ::= LOAD_FAST
load ::= LOAD_NAME
"""
class Python3ParserSingle(Python3Parser, PythonParserSingle):