From d3e4a8ef1034fd3688f18b2638caf21d5fc86d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hakan=20=C3=87EL=C4=B0K?= Date: Fri, 17 Apr 2020 17:15:59 +0300 Subject: [PATCH] Add spaces := in ast_unparse.c --- Lib/test/test_future.py | 4 ++-- Python/ast_unparse.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py index 0522003d3c9b97..fdca2312fab7c2 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:=10)") - eq("f'{(x:=10):=10}'") + eq("(x := 10)") + eq("f'{(x := 10):=10}'") eq("1 + 2 + 3") def test_fstring_debug_annotations(self): diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c index 443e7125d774e2..d1e9d42d33bd43 100644 --- a/Python/ast_unparse.c +++ b/Python/ast_unparse.c @@ -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;