]> granicus.if.org Git - python/commitdiff
Oops. Return -1 to distinguish error from empty dict.
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 17 Feb 2004 20:10:11 +0000 (20:10 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 17 Feb 2004 20:10:11 +0000 (20:10 +0000)
This change probably isn't work a bug fix.  It's unlikely that anyone
was calling this method without passing it a real dict.

Objects/dictobject.c

index 35a3e31672b6069bfdf4e855ab6315d8119d5a1e..eb0222cdd56d9e970e10f7852183b23ce2e06c88 100644 (file)
@@ -1256,7 +1256,7 @@ PyDict_Size(PyObject *mp)
 {
        if (mp == NULL || !PyDict_Check(mp)) {
                PyErr_BadInternalCall();
-               return 0;
+               return -1;
        }
        return ((dictobject *)mp)->ma_used;
 }