[Python-checkins] [3.11] gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107) (#104260)

kumaraditya303 webhook-mailer at python.org
Sun May 7 01:06:13 EDT 2023


https://github.com/python/cpython/commit/15ffcf76e1b6bdd14aff0875beb2a8f2afdaf374
commit: 15ffcf76e1b6bdd14aff0875beb2a8f2afdaf374
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-05-07T05:06:06Z
summary:

[3.11] gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107) (#104260)

gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107)

This is a cleanup overlooked in PR GH-104033.
(cherry picked from commit 69621d1b09c996e43a1e13d2fa4c317d3dd4d738)

Co-authored-by: John Belmonte <john at neggie.net>

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

diff --git a/Include/internal/pycore_format.h b/Include/internal/pycore_format.h
index 1899609e77ef..1b8d57539ca5 100644
--- a/Include/internal/pycore_format.h
+++ b/Include/internal/pycore_format.h
@@ -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
 }
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 61cde0ef34bf..3b0ff9a19d97 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -430,9 +430,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)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 84d17f000b41..4bdc89316a86 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -14385,8 +14385,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;
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index b1d807bcf10a..77ed29d0cddd 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -310,7 +310,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;
     }



More information about the Python-checkins mailing list