some lambda's can't have \n + grammar cleanup

This commit is contained in:
rocky
2022-05-14 20:25:33 -04:00
parent 0ca2eca32f
commit 14fe8c5356
6 changed files with 4 additions and 17 deletions

View File

@@ -46,10 +46,7 @@ def test_grammar():
expect_lhs.add("kv3")
unused_rhs.add("dict")
else:
# NOTE: this may disappear
expect_lhs.add("except_handler_else")
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] != (2, 7):
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] not in ((2, 7), (2, 6)):
# NOTE: this may disappear
expect_lhs.add("except_handler_else")

View File

@@ -42,7 +42,7 @@ SKIP_TESTS=(
[test_decimal.py]=1 #
[test_dis.py]=1 # We change line numbers - duh!
[test_generators.py]=1 # Investigate
[test_grammar.py]=1 # Too many stmts. Handle large stmts
# [test_grammar.py]=1 # fails on its own - no module tests.test_support
[test_grp.py]=1 # Long test - might work Control flow?
[test_pep247.py]=1 # Long test - might work? Control flow?
[test_socketserver.py]=1 # -- test takes too long to run: 40 seconds

View File

@@ -44,7 +44,7 @@ SKIP_TESTS=(
[test_dis.py]=1 # We change line numbers - duh!
[test_file.py]=1 # test assertion failures
[test_generators.py]=1 # Investigate
[test_grammar.py]=1 # Too many stmts. Handle large stmts
# [test_grammar.py]=1 # fails on its own - no module tests.test_support
[test_grp.py]=1 # Long test - might work Control flow?
[test_macfs.py]=1 # it fails on its own
[test_macostools.py]=1 # it fails on its own

View File

@@ -9,7 +9,6 @@ SKIP_TESTS=(
[test_doctest.py]=1 # Fails on its own
[test_exceptions.py]=1
[test_format.py]=1 # Control flow "and" vs nested "if"
[test_grammar.py]=1 # Too many stmts. Handle large stmts
[test_grp.py]=1 # test takes to long, works interactively though
[test_io.py]=1 # Test takes too long to run
[test_ioctl.py]=1 # Test takes too long to run

View File

@@ -312,11 +312,6 @@ class Python26Parser(Python2Parser):
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP
jmp_false_then compare_chained2 _come_froms
return_lambda ::= RETURN_VALUE
return_lambda ::= RETURN_END_IF
return_lambda ::= RETURN_END_IF_LAMBDA
return_lambda ::= RETURN_VALUE_LAMBDA
compare_chained2 ::= expr COMPARE_OP return_expr_lambda
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF COME_FROM

View File

@@ -1180,11 +1180,7 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
# Adding a "\n" after "lambda x: x" will give an error message:
# SyntaxError: f-string expression part cannot include a backslash
# So avoid that.
if self.in_format_string and is_lambda:
printfn = self.write
else:
printfn = self.println
printfn(self.text)
self.write(self.text)
self.name = old_name
self.return_none = rn