summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-07-28 15:19:47 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-07-28 15:19:47 (GMT)
commit7beeed5dfd9fb81e4d4ea44bb0fe8a5e41084b8c (patch)
tree773f92221877abfd1cfe11e05b0c0024d9adf089 /Objects
parent77c72bb3236757ea0cf9bc8bc1c3f7ec28de777a (diff)
downloadcpython-7beeed5dfd9fb81e4d4ea44bb0fe8a5e41084b8c.zip
cpython-7beeed5dfd9fb81e4d4ea44bb0fe8a5e41084b8c.tar.gz
cpython-7beeed5dfd9fb81e4d4ea44bb0fe8a5e41084b8c.tar.bz2
SF patch #577031, remove PyArg_Parse() since it's deprecated
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index bf548cd..83421a9 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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;