]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)
authorJohn Belmonte <john@neggie.net>
Mon, 11 Apr 2022 14:34:18 +0000 (23:34 +0900)
committerGitHub <noreply@github.com>
Mon, 11 Apr 2022 14:34:18 +0000 (15:34 +0100)
commitb0b836b20cb56c225874a4a39ef895f89ab2970f
treeb333cd2e9ee95021e1fc3b45eee2da0b7ac0ee35
parentdd207a6ac52d4bd9a71cf178fc1d5c17a6f07aff
bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)

Add "z" format specifier to coerce negative 0 to zero.

See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion.
This covers `str.format()` and f-strings.  Old-style string interpolation is not supported.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
16 files changed:
Doc/library/string.rst
Include/internal/pycore_format.h
Include/pystrtod.h
Lib/_pydecimal.py
Lib/pydoc_data/topics.py
Lib/test/test_decimal.py
Lib/test/test_float.py
Lib/test/test_format.py
Lib/test/test_types.py
Misc/NEWS.d/next/Library/2021-12-14-13-15-41.bpo-45995.Am9pNL.rst [new file with mode: 0644]
Modules/_decimal/_decimal.c
Objects/bytesobject.c
Objects/unicodeobject.c
Python/ast_opt.c
Python/formatter_unicode.c
Python/pystrtod.c