[Python-checkins] (no subject)

Hakan Çelik webhook-mailer at python.org
Sat Apr 18 12:17:26 EDT 2020




To: python-checkins at python.org
Subject: Add spaces around the ":=" operator in ast_unparse.c (GH-19568)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

https://github.com/python/cpython/commit/ce578831a4e573eac422a488930100bc5380=
f227
commit: ce578831a4e573eac422a488930100bc5380f227
branch: master
author: Hakan =C3=87elik <hakancelik96 at outlook.com>
committer: GitHub <noreply at github.com>
date: 2020-04-18T17:17:19+01:00
summary:

Add spaces around the ":=3D" operator in ast_unparse.c (GH-19568)

files:
M Lib/test/test_future.py
M Python/ast_unparse.c

diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 0522003d3c9b9..fdca2312fab7c 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -296,8 +296,8 @@ def test_annotations(self):
         eq('f((x for x in a), 2)')
         eq('(((a)))', 'a')
         eq('(((a, b)))', '(a, b)')
-        eq("(x:=3D10)")
-        eq("f'{(x:=3D10):=3D10}'")
+        eq("(x :=3D 10)")
+        eq("f'{(x :=3D 10):=3D10}'")
         eq("1 + 2 + 3")
=20
     def test_fstring_debug_annotations(self):
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c
index 443e7125d774e..d1e9d42d33bd4 100644
--- a/Python/ast_unparse.c
+++ b/Python/ast_unparse.c
@@ -829,7 +829,7 @@ append_named_expr(_PyUnicodeWriter *writer, expr_ty e, in=
t level)
 {
     APPEND_STR_IF(level > PR_TUPLE, "(");
     APPEND_EXPR(e->v.NamedExpr.target, PR_ATOM);
-    APPEND_STR(":=3D");
+    APPEND_STR(" :=3D ");
     APPEND_EXPR(e->v.NamedExpr.value, PR_ATOM);
     APPEND_STR_IF(level > PR_TUPLE, ")");
     return 0;



More information about the Python-checkins mailing list