]> granicus.if.org Git - python/commitdiff
SF patch #577031, remove PyArg_Parse() since it's deprecated
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 28 Jul 2002 15:19:47 +0000 (15:19 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 28 Jul 2002 15:19:47 +0000 (15:19 +0000)
Objects/stringobject.c

index bf548cdd261bafff0c32cd1a1be4519d63fd8366..83421a944c6a6ed5056dafcd719d30fdcf710f66 100644 (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;