You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
some lambda's can't have \n + grammar cleanup
This commit is contained in:
@@ -46,10 +46,7 @@ def test_grammar():
|
|||||||
expect_lhs.add("kv3")
|
expect_lhs.add("kv3")
|
||||||
unused_rhs.add("dict")
|
unused_rhs.add("dict")
|
||||||
else:
|
else:
|
||||||
# NOTE: this may disappear
|
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] not in ((2, 7), (2, 6)):
|
||||||
expect_lhs.add("except_handler_else")
|
|
||||||
|
|
||||||
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] != (2, 7):
|
|
||||||
# NOTE: this may disappear
|
# NOTE: this may disappear
|
||||||
expect_lhs.add("except_handler_else")
|
expect_lhs.add("except_handler_else")
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ SKIP_TESTS=(
|
|||||||
[test_decimal.py]=1 #
|
[test_decimal.py]=1 #
|
||||||
[test_dis.py]=1 # We change line numbers - duh!
|
[test_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_generators.py]=1 # Investigate
|
[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_grp.py]=1 # Long test - might work Control flow?
|
||||||
[test_pep247.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
|
[test_socketserver.py]=1 # -- test takes too long to run: 40 seconds
|
||||||
|
@@ -44,7 +44,7 @@ SKIP_TESTS=(
|
|||||||
[test_dis.py]=1 # We change line numbers - duh!
|
[test_dis.py]=1 # We change line numbers - duh!
|
||||||
[test_file.py]=1 # test assertion failures
|
[test_file.py]=1 # test assertion failures
|
||||||
[test_generators.py]=1 # Investigate
|
[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_grp.py]=1 # Long test - might work Control flow?
|
||||||
[test_macfs.py]=1 # it fails on its own
|
[test_macfs.py]=1 # it fails on its own
|
||||||
[test_macostools.py]=1 # it fails on its own
|
[test_macostools.py]=1 # it fails on its own
|
||||||
|
@@ -9,7 +9,6 @@ SKIP_TESTS=(
|
|||||||
[test_doctest.py]=1 # Fails on its own
|
[test_doctest.py]=1 # Fails on its own
|
||||||
[test_exceptions.py]=1
|
[test_exceptions.py]=1
|
||||||
[test_format.py]=1 # Control flow "and" vs nested "if"
|
[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_grp.py]=1 # test takes to long, works interactively though
|
||||||
[test_io.py]=1 # Test takes too long to run
|
[test_io.py]=1 # Test takes too long to run
|
||||||
[test_ioctl.py]=1 # Test takes too long to run
|
[test_ioctl.py]=1 # Test takes too long to run
|
||||||
|
@@ -312,11 +312,6 @@ class Python26Parser(Python2Parser):
|
|||||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP
|
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP
|
||||||
jmp_false_then compare_chained2 _come_froms
|
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_expr_lambda
|
||||||
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
|
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF_LAMBDA
|
||||||
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF COME_FROM
|
compare_chained2 ::= expr COMPARE_OP RETURN_END_IF COME_FROM
|
||||||
|
@@ -1180,11 +1180,7 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
|
|||||||
# Adding a "\n" after "lambda x: x" will give an error message:
|
# Adding a "\n" after "lambda x: x" will give an error message:
|
||||||
# SyntaxError: f-string expression part cannot include a backslash
|
# SyntaxError: f-string expression part cannot include a backslash
|
||||||
# So avoid that.
|
# So avoid that.
|
||||||
if self.in_format_string and is_lambda:
|
self.write(self.text)
|
||||||
printfn = self.write
|
|
||||||
else:
|
|
||||||
printfn = self.println
|
|
||||||
printfn(self.text)
|
|
||||||
self.name = old_name
|
self.name = old_name
|
||||||
self.return_none = rn
|
self.return_none = rn
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user