mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
SF patch #577031, remove PyArg_Parse() since it's deprecated
This commit is contained in:
@@ -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)*/
|
||||
char fmt[20];
|
||||
double x;
|
||||
if (!PyArg_Parse(v, "d;float argument required", &x))
|
||||
v = PyNumber_Float(v);
|
||||
if (!v)
|
||||
return -1;
|
||||
x = PyFloat_AS_DOUBLE(v);
|
||||
Py_DECREF(v);
|
||||
if (prec < 0)
|
||||
prec = 6;
|
||||
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! */
|
||||
long x;
|
||||
|
||||
if (!PyArg_Parse(v, "l;int argument required", &x))
|
||||
v = PyNumber_Int(v);
|
||||
if (!v)
|
||||
return -1;
|
||||
x = PyInt_AS_LONG(v);
|
||||
Py_DECREF(v);
|
||||
if (prec < 0)
|
||||
prec = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user