]> granicus.if.org Git - python/commitdiff
Clarify return value of PyLong_AsLongLong().
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 23 Apr 2002 20:01:20 +0000 (20:01 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 23 Apr 2002 20:01:20 +0000 (20:01 +0000)
The function is documented to return -1 on error.  If res was < 0, it
returned res.  It wasn't clear that the invariant was res < 0 iff res
== -1.

Objects/longobject.c

index f11c0162947472af3ba59148ecd30a5659fd7a70..cbc9f68ca535c8b1455459bfafedbddea8ce05c1 100644 (file)
@@ -696,7 +696,7 @@ PyLong_AsLongLong(PyObject *vv)
 
        /* Plan 9 can't handle LONG_LONG in ? : expressions */
        if (res < 0)
-               return (LONG_LONG)res;
+               return (LONG_LONG)-1;
        else
                return bytes;
 }