You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
3.4 while1 bug fix
This commit is contained in:
BIN
test/bytecode_3.3/10_while1_popblock.pyc
Normal file
BIN
test/bytecode_3.3/10_while1_popblock.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.4/10_while1_popblock.pyc
Normal file
BIN
test/bytecode_3.4/10_while1_popblock.pyc
Normal file
Binary file not shown.
17
test/simple_source/bug33/10_while1_popblock.py
Normal file
17
test/simple_source/bug33/10_while1_popblock.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# From 3.4.4 mailcap.py
|
||||
# Bug was needing a grammar rule to add POP_BLOCK before the end of the while1.
|
||||
# 3.3 apparently doesn't add this.
|
||||
def readmailcapfile(line):
|
||||
while 1:
|
||||
if not line: break
|
||||
if line[0] == '#' or line.strip() == '':
|
||||
continue
|
||||
if not line:
|
||||
continue
|
||||
for j in range(3):
|
||||
line[j] = line[j].strip()
|
||||
if '/' in line:
|
||||
line['/'].append('a')
|
||||
else:
|
||||
line['/'] = 'a'
|
||||
return
|
@@ -1,4 +1,17 @@
|
||||
# Copyright (c) 2017 Rocky Bernstein
|
||||
# Copyright (c) 2017-2018 Rocky Bernstein
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
spark grammar differences over Python 3.3 for Python 3.4
|
||||
"""
|
||||
@@ -18,6 +31,9 @@ class Python34Parser(Python33Parser):
|
||||
expr ::= LOAD_ASSERT
|
||||
|
||||
|
||||
while1stmt ::= SETUP_LOOP l_stmts
|
||||
COME_FROM JUMP_BACK POP_BLOCK COME_FROM_LOOP
|
||||
|
||||
# FIXME the below masks a bug in not detecting COME_FROM_LOOP
|
||||
# grammar rules with COME_FROM -> COME_FROM_LOOP already exist
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||
@@ -30,8 +46,9 @@ class Python34Parser(Python33Parser):
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
# self.remove_rules("""
|
||||
# """)
|
||||
self.remove_rules("""
|
||||
while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
|
||||
""")
|
||||
super(Python34Parser, self).customize_grammar_rules(tokens, customize)
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user