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

This commit is contained in:
Neal Norwitz 2002-07-28 15:19:47 +00:00
parent 77c72bb323
commit 7beeed5dfd

View file

@ -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;