From b4db22d52536d52faa7a4918c00efe1745233609 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 3 Sep 2020 04:35:59 -0400 Subject: [PATCH] Narrow precedence for call statement --- uncompyle6/semantics/consts.py | 5 ++++- uncompyle6/semantics/customize37.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/uncompyle6/semantics/consts.py b/uncompyle6/semantics/consts.py index d1609b62..6d918338 100644 --- a/uncompyle6/semantics/consts.py +++ b/uncompyle6/semantics/consts.py @@ -327,7 +327,10 @@ TABLE_DIRECT = { # For compatibility with older Python, we'll use "%" instead of # a format string. "string_at_beginning": ('%|"%%s" %% %c\n', 0), - "call_stmt": ("%|%p\n", (0, 200)), + "call_stmt": ( "%|%p\n", + # When a call statement contains only a named_expr (:=) + # the named_expr should have parenthesis around it. + (0, PRECEDENCE["named_expr"]-1)), "break": ("%|break\n",), "continue": ("%|continue\n",), "raise_stmt0": ("%|raise\n",), diff --git a/uncompyle6/semantics/customize37.py b/uncompyle6/semantics/customize37.py index 52e42fbc..a9663b8d 100644 --- a/uncompyle6/semantics/customize37.py +++ b/uncompyle6/semantics/customize37.py @@ -149,6 +149,11 @@ def customize_for_version37(self, version): (1, "store"), (0, "get_aiter"), (3, "list_iter"), ), + "list_afor": ( + " async for %[1]{%c} in %c%[1]{%c}", + (1, "store"), (0, "get_aiter"), (3, "list_iter"), + ), + "list_if37": (" if %p%c", (0, 27), 1), "list_if37_not": (" if not %p%c", (0, 27), 1), "testfalse_not_or": ("not %c or %c", (0, "expr"), (2, "expr")),