]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104018: remove unused format "z" handling in string formatfloat() (#104107)
authorJohn Belmonte <john@neggie.net>
Sun, 7 May 2023 04:41:42 +0000 (13:41 +0900)
committerGitHub <noreply@github.com>
Sun, 7 May 2023 04:41:42 +0000 (10:11 +0530)
This is a cleanup overlooked in PR #104033.

Include/internal/pycore_format.h
Objects/bytesobject.c
Objects/unicodeobject.c
Python/ast_opt.c

index 1899609e77ef2013b9261eb443737a4e3a2a2aa6..1b8d57539ca505fbc56ecb2245785a8b37b85c9f 100644 (file)
@@ -14,14 +14,12 @@ extern "C" {
  * F_BLANK      ' '
  * F_ALT        '#'
  * F_ZERO       '0'
- * F_NO_NEG_0   'z'
  */
 #define F_LJUST (1<<0)
 #define F_SIGN  (1<<1)
 #define F_BLANK (1<<2)
 #define F_ALT   (1<<3)
 #define F_ZERO  (1<<4)
-#define F_NO_NEG_0 (1<<5)
 
 #ifdef __cplusplus
 }
index e7e85cc19cda75e9b464c6acee0b295c6bbd251a..abbf3eeb16c35c64b11c3af2c1368c6dc6c454ac 100644 (file)
@@ -423,9 +423,6 @@ formatfloat(PyObject *v, int flags, int prec, int type,
     if (flags & F_ALT) {
         dtoa_flags |= Py_DTSF_ALT;
     }
-    if (flags & F_NO_NEG_0) {
-        dtoa_flags |= Py_DTSF_NO_NEG_0;
-    }
     p = PyOS_double_to_string(x, type, prec, dtoa_flags, NULL);
 
     if (p == NULL)
index 1585a582f00aad0517ad5b48dcf30873bb7f51ff..7726f2fb17afde0067691de7b20112f4b03fab62 100644 (file)
@@ -13452,8 +13452,6 @@ formatfloat(PyObject *v, struct unicode_format_arg_t *arg,
 
     if (arg->flags & F_ALT)
         dtoa_flags |= Py_DTSF_ALT;
-    if (arg->flags & F_NO_NEG_0)
-        dtoa_flags |= Py_DTSF_NO_NEG_0;
     p = PyOS_double_to_string(x, arg->ch, prec, dtoa_flags, NULL);
     if (p == NULL)
         return -1;
index 8270fa8e372d93e28913c1e978a50c76be8b7a6b..3883ec9e21c76519a4e82ee3b74c56d629ad5890 100644 (file)
@@ -317,7 +317,6 @@ simple_format_arg_parse(PyObject *fmt, Py_ssize_t *ppos,
             case ' ': *flags |= F_BLANK; continue;
             case '#': *flags |= F_ALT; continue;
             case '0': *flags |= F_ZERO; continue;
-            case 'z': *flags |= F_NO_NEG_0; continue;
         }
         break;
     }