Skip to content

Commit ce57883

Browse files
Add spaces around the ":=" operator in ast_unparse.c (GH-19568)
1 parent 2b56031 commit ce57883

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/test/test_future.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ def test_annotations(self):
296296
eq('f((x for x in a), 2)')
297297
eq('(((a)))', 'a')
298298
eq('(((a, b)))', '(a, b)')
299-
eq("(x:=10)")
300-
eq("f'{(x:=10):=10}'")
299+
eq("(x := 10)")
300+
eq("f'{(x := 10):=10}'")
301301
eq("1 + 2 + 3")
302302

303303
def test_fstring_debug_annotations(self):

Python/ast_unparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ append_named_expr(_PyUnicodeWriter *writer, expr_ty e, int level)
829829
{
830830
APPEND_STR_IF(level > PR_TUPLE, "(");
831831
APPEND_EXPR(e->v.NamedExpr.target, PR_ATOM);
832-
APPEND_STR(":=");
832+
APPEND_STR(" := ");
833833
APPEND_EXPR(e->v.NamedExpr.value, PR_ATOM);
834834
APPEND_STR_IF(level > PR_TUPLE, ")");
835835
return 0;

0 commit comments

Comments
 (0)