Need parens in unpack in 2.4ish

This commit is contained in:
rocky
2019-07-03 20:04:45 -04:00
parent 40d2ef3071
commit e56088b566
2 changed files with 7 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ def main_bin():
'fragments verify verify-run version '
'syntax-verify '
'showgrammar encoding='.split(' '))
except getopt.GetoptError(e):
except getopt.GetoptError, e:
sys.stderr.write('%s: %s\n' %
(os.path.basename(sys.argv[0]), e))
sys.exit(-1)

View File

@@ -1827,9 +1827,15 @@ class SourceWalker(GenericASTTraversal, object):
self.write(', ')
self.prune()
return
for n in node[1:]:
if n[0].kind == 'unpack':
n[0].kind = 'unpack_w_parens'
# In Python 2.4, unpack is used in (a, b, c) of:
# except RuntimeError, (a, b, c):
if self.version < 2.7:
node.kind = 'unpack_w_parens'
self.default(node)
n_unpack_w_parens = n_unpack