]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add spaces around the ":=" operator in ast_unparse.c (GH-19568)
authorHakan Çelik <hakancelik96@outlook.com>
Sat, 18 Apr 2020 16:17:19 +0000 (19:17 +0300)
committerGitHub <noreply@github.com>
Sat, 18 Apr 2020 16:17:19 +0000 (17:17 +0100)
Lib/test/test_future.py
Python/ast_unparse.c

index 0522003d3c9b9717fdc04fd47e518eb98d185044..fdca2312fab7c277f85baaa7cfea641a262b4790 100644 (file)
@@ -296,8 +296,8 @@ class AnnotationsFutureTestCase(unittest.TestCase):
         eq('f((x for x in a), 2)')
         eq('(((a)))', 'a')
         eq('(((a, b)))', '(a, b)')
-        eq("(x:=10)")
-        eq("f'{(x:=10):=10}'")
+        eq("(x := 10)")
+        eq("f'{(x := 10):=10}'")
         eq("1 + 2 + 3")
 
     def test_fstring_debug_annotations(self):
index 443e7125d774e24f16b05e6bce7a0ca2273fa926..d1e9d42d33bd4334055ba4bdac76c45b20a50cb7 100644 (file)
@@ -829,7 +829,7 @@ append_named_expr(_PyUnicodeWriter *writer, expr_ty e, int level)
 {
     APPEND_STR_IF(level > PR_TUPLE, "(");
     APPEND_EXPR(e->v.NamedExpr.target, PR_ATOM);
-    APPEND_STR(":=");
+    APPEND_STR(" := ");
     APPEND_EXPR(e->v.NamedExpr.value, PR_ATOM);
     APPEND_STR_IF(level > PR_TUPLE, ")");
     return 0;