Commit 7beeed5d authored by Neal Norwitz's avatar Neal Norwitz

SF patch #577031, remove PyArg_Parse() since it's deprecated

parent 77c72bb3
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment