Towards Python3 getting try/except working more often.

This commit is contained in:
rocky
2015-12-30 09:46:52 -05:00
parent 313a8578b3
commit 657eeb7de8
10 changed files with 49 additions and 59 deletions

View File

@@ -317,6 +317,8 @@ TABLE_DIRECT = {
'tryelsestmtl': ( '%|try:\n%+%c%-%c%|else:\n%+%c%-', 1, 3, 4 ),
'tf_trystmt': ( '%c%-%c%+', 1, 3 ),
'tf_tryelsestmt': ( '%c%-%c%|else:\n%+%c', 1, 3, 4 ),
'except': ('%|except:\n%+%c%-', 3 ),
'except_pop_except': ('%|except:\n%+%c%-', 4 ),
'except_cond1': ( '%|except %c:\n', 1 ),
'except_cond2': ( '%|except %c as %c:\n', 1, 5 ),
'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ),
@@ -503,12 +505,6 @@ class Walker(GenericASTTraversal, object):
self.pending_newlines = 0
self.hide_internal = True
if version >= 3.0:
# Python 3 adds a POP_EXCEPT instruction
TABLE_DIRECT['except'] = ('%|except:\n%+%c%-', 4 )
else:
TABLE_DIRECT['except'] = ('%|except:\n%+%c%-', 3 )
pass
return
f = property(lambda s: s.params['f'],
@@ -1251,7 +1247,6 @@ class Walker(GenericASTTraversal, object):
# self.print_("-----")
# self.print(startnode)
fmt = entry[0]
arg = 1
i = 0