Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 24409:d6ec4dab927e legacy-trunk
SF patch #577031, remove PyArg_Parse() since it's deprecated
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 28 Jul 2002 15:19:47 +0000 |
| parents | 81ca6ca5c307 |
| children | f5cfa0ee02cf |
line wrap: on
line diff
--- a/Objects/stringobject.c Sun Jul 28 15:12:10 2002 +0000 +++ b/Objects/stringobject.c Sun Jul 28 15:19:47 2002 +0000 @@ -3120,8 +3120,11 @@ 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 @@ 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;
