mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
SF patch #577031, remove PyArg_Parse() since it's deprecated
This commit is contained in:
parent
77c72bb323
commit
7beeed5dfd
1 changed files with 8 additions and 2 deletions
|
@ -3120,8 +3120,11 @@ formatfloat(char *buf, size_t buflen, int flags,
|
||||||
worst case length = 3 + 10 (len of INT_MAX) + 1 = 14 (use 20)*/
|
worst case length = 3 + 10 (len of INT_MAX) + 1 = 14 (use 20)*/
|
||||||
char fmt[20];
|
char fmt[20];
|
||||||
double x;
|
double x;
|
||||||
if (!PyArg_Parse(v, "d;float argument required", &x))
|
v = PyNumber_Float(v);
|
||||||
|
if (!v)
|
||||||
return -1;
|
return -1;
|
||||||
|
x = PyFloat_AS_DOUBLE(v);
|
||||||
|
Py_DECREF(v);
|
||||||
if (prec < 0)
|
if (prec < 0)
|
||||||
prec = 6;
|
prec = 6;
|
||||||
if (type == 'f' && fabs(x)/1e25 >= 1e25)
|
if (type == 'f' && fabs(x)/1e25 >= 1e25)
|
||||||
|
@ -3296,8 +3299,11 @@ formatint(char *buf, size_t buflen, int flags,
|
||||||
char fmt[64]; /* plenty big enough! */
|
char fmt[64]; /* plenty big enough! */
|
||||||
long x;
|
long x;
|
||||||
|
|
||||||
if (!PyArg_Parse(v, "l;int argument required", &x))
|
v = PyNumber_Int(v);
|
||||||
|
if (!v)
|
||||||
return -1;
|
return -1;
|
||||||
|
x = PyInt_AS_LONG(v);
|
||||||
|
Py_DECREF(v);
|
||||||
if (prec < 0)
|
if (prec < 0)
|
||||||
prec = 1;
|
prec = 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue