summaryrefslogtreecommitdiffstats
path: root/Include/pystrtod.h
diff options
context:
space:
mode:
authorJohn Belmonte <john@neggie.net>2022-04-11 14:34:18 (GMT)
committerGitHub <noreply@github.com>2022-04-11 14:34:18 (GMT)
commitb0b836b20cb56c225874a4a39ef895f89ab2970f (patch)
treeb333cd2e9ee95021e1fc3b45eee2da0b7ac0ee35 /Include/pystrtod.h
parentdd207a6ac52d4bd9a71cf178fc1d5c17a6f07aff (diff)
downloadcpython-b0b836b20cb56c225874a4a39ef895f89ab2970f.zip
cpython-b0b836b20cb56c225874a4a39ef895f89ab2970f.tar.gz
cpython-b0b836b20cb56c225874a4a39ef895f89ab2970f.tar.bz2
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>
Diffstat (limited to 'Include/pystrtod.h')
-rw-r--r--Include/pystrtod.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/pystrtod.h b/Include/pystrtod.h
index c1e84de..fa056d1 100644
--- a/Include/pystrtod.h
+++ b/Include/pystrtod.h
@@ -32,6 +32,7 @@ PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
#define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */
#define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code
specific */
+#define Py_DTSF_NO_NEG_0 0x08 /* negative zero result is coerced to 0 */
/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */
#define Py_DTST_FINITE 0