Fix Python 2.4-2.6 comp_for text generation...

Makefile: tolerate pypy 5.3.x
Rest: fix semantic action rule for comp_for and test this
This commit is contained in:
rocky
2016-09-03 00:30:48 -04:00
parent f1bb40f485
commit 52a35e6c62
5 changed files with 13 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ check-2.6:
#:PyPy 2.6.1 or PyPy 5.0.1
# Skip for now
2.6 5.0:
2.6 5.0 5.3:
#:PyPy pypy3-2.4.0 Python 3:
pypy-3.2 2.4:

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
# From python2.6/_abcoll.py
# Bug was wrong code for "comp_for" giving
# "for in x" instead of: "for x in y"
chain = (e for s in (self, other) for x in y)

View File

@@ -223,7 +223,6 @@ TABLE_DIRECT = {
'lc_body': ( '', ), # ignore when recusing
'comp_iter': ( '%c', 0),
'comp_for': ( ' for %c in %c%c', 2, 0, 3 ),
'comp_if': ( ' if %c%c', 0, 2 ),
'comp_ifnot': ( ' if not %p%c', (0, 22), 2 ),
'comp_body': ( '', ), # ignore when recusing
@@ -596,6 +595,14 @@ class SourceWalker(GenericASTTraversal, object):
TABLE_DIRECT.update({
'except_cond3': ( '%|except %c, %c:\n', 1, 6 ),
})
if 2.4 <= version <= 2.6:
TABLE_DIRECT.update({
'comp_for': ( ' for %c in %c', 3, 1 ),
})
else:
TABLE_DIRECT.update({
'comp_for': ( ' for %c in %c%c', 2, 0, 3 ),
})
##########################