Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2018-01-13 01:05:38 -05:00
7 changed files with 41 additions and 11 deletions

Binary file not shown.

View File

@@ -12,3 +12,14 @@ def test_specific_values(self):
self = 2 self = 2
self = 3 self = 3
# From 2.6 test_decorators.
# Bug was thinking an "except" was some sort of if/then
def call(*args):
try:
return 5
except KeyError:
return 2
except TypeError:
# Unhashable argument
return 3

View File

@@ -0,0 +1,12 @@
# From Python 2.7 ihooks.py
def ensure_fromlist(self, fromlist):
for sub in fromlist:
if sub:
if not recursive:
try:
all = 5
except AttributeError:
pass
else:
all = 6
continue

View File

@@ -44,13 +44,11 @@ case $PYVERSION in
2.6) 2.6)
SKIP_TESTS=( SKIP_TESTS=(
[test_grp.py]=1 # Long test - might work Control flow? [test_grp.py]=1 # Long test - might work Control flow?
[test_opcodes.py]=1
[test_pwd.py]=1 # Long test - might work? Control flow? [test_pwd.py]=1 # Long test - might work? Control flow?
[test_re.py]=1 # Probably Control flow? [test_re.py]=1 # Probably Control flow?
[test_trace.py]=1 # Line numbers are expected to be different [test_trace.py]=1 # Line numbers are expected to be different
# .pyenv/versions/2.6.9/lib/python2.6/lib2to3/refactor.pyc # .pyenv/versions/2.6.9/lib/python2.6/lib2to3/refactor.pyc
# .pyenv/versions/2.6.9/lib/python2.6/mailbox.pyc
# .pyenv/versions/2.6.9/lib/python2.6/markupbase.pyc
# .pyenv/versions/2.6.9/lib/python2.6/pstats.pyc
# .pyenv/versions/2.6.9/lib/python2.6/pyclbr.pyc # .pyenv/versions/2.6.9/lib/python2.6/pyclbr.pyc
# .pyenv/versions/2.6.9/lib/python2.6/quopri.pyc -- look at ishex, is short # .pyenv/versions/2.6.9/lib/python2.6/quopri.pyc -- look at ishex, is short
# .pyenv/versions/2.6.9/lib/python2.6/random.pyc # .pyenv/versions/2.6.9/lib/python2.6/random.pyc

View File

@@ -50,6 +50,9 @@ class Python27Parser(Python2Parser):
tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
except_handler else_suite COME_FROM except_handler else_suite COME_FROM
tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
except_handler else_suitel JUMP_BACK COME_FROM
except_stmt ::= except_cond2 except_suite except_stmt ::= except_cond2 except_suite
except_cond1 ::= DUP_TOP expr COMPARE_OP except_cond1 ::= DUP_TOP expr COMPARE_OP

View File

@@ -898,7 +898,6 @@ class Scanner2(Scanner):
self.structs.append({'type': 'if-then', self.structs.append({'type': 'if-then',
'start': start-3, 'start': start-3,
'end': pre_rtarget}) 'end': pre_rtarget})
self.thens[start] = end self.thens[start] = end
elif jump_op == 'JUMP_ABSOLUTE': elif jump_op == 'JUMP_ABSOLUTE':
if_then_maybe = {'type': 'if-then', if_then_maybe = {'type': 'if-then',
@@ -941,13 +940,20 @@ class Scanner2(Scanner):
'end': end}) 'end': end})
elif code_pre_rtarget == self.opc.RETURN_VALUE: elif code_pre_rtarget == self.opc.RETURN_VALUE:
if self.version == 2.7 or pre_rtarget not in self.ignore_if: if self.version == 2.7 or pre_rtarget not in self.ignore_if:
self.structs.append({'type': 'if-then', # 10 is exception-match. If there is an exception match in the
'start': start, # compare, then this is an exception clause not an if-then clause
'end': rtarget}) if (self.code[self.prev[offset]] != self.opc.COMPARE_OP or
self.thens[start] = rtarget self.code[self.prev[offset]+1] != 10):
if self.version == 2.7 or code[pre_rtarget+1] != self.opc.JUMP_FORWARD: self.structs.append({'type': 'if-then',
self.fixed_jumps[offset] = rtarget 'start': start,
self.return_end_ifs.add(pre_rtarget) 'end': rtarget})
self.thens[start] = rtarget
if self.version == 2.7 or code[pre_rtarget+1] != self.opc.JUMP_FORWARD:
self.fixed_jumps[offset] = rtarget
self.return_end_ifs.add(pre_rtarget)
pass
pass
pass
elif op in self.pop_jump_if_or_pop: elif op in self.pop_jump_if_or_pop:
target = self.get_target(offset, op) target = self.get_target(offset, op)