]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fixed arg checking for keys() and close()
authorGuido van Rossum <guido@python.org>
Tue, 18 Jul 1995 18:33:09 +0000 (18:33 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Jul 1995 18:33:09 +0000 (18:33 +0000)
Modules/dbhashmodule.c

index 324f9288a927a93a86e56008552673f3adeb8a4a..e04cebcb8fecafc56819b01c986eaa6aba5e8cd7 100644 (file)
@@ -91,21 +91,6 @@ newdbhashobject(file, flags, mode,
     return (object *)dp;
 }
 
-static object *
-dbhash_close(dp)
-    dbhashobject *dp;
-{
-    if (dp->di_dbhash != NULL) {
-       if ((dp->di_dbhash->close)(dp->di_dbhash) != 0) {
-           err_errno(DbhashError);
-           return NULL;
-       }
-    }
-    dp->di_dbhash = NULL;
-    INCREF(None);
-    return None;
-}
-
 static void
 dbhash_dealloc(dp)
     dbhashobject *dp;
@@ -212,6 +197,25 @@ static mapping_methods dbhash_as_mapping = {
     (objobjargproc)dbhash_ass_sub,     /*mp_ass_subscript*/
 };
 
+static object *
+dbhash_close(dp, args)
+    dbhashobject *dp;
+    object *args;
+{
+    if (!getnoarg(args))
+       return NULL;
+    if (dp->di_dbhash != NULL) {
+       if ((dp->di_dbhash->close)(dp->di_dbhash) != 0) {
+               dp->di_dbhash = NULL;
+           err_errno(DbhashError);
+           return NULL;
+       }
+    }
+    dp->di_dbhash = NULL;
+    INCREF(None);
+    return None;
+}
+
 static object *
 dbhash_keys(dp, args)
     dbhashobject *dp;
@@ -222,10 +226,6 @@ dbhash_keys(dp, args)
     int status;
     int err;
 
-    if (dp == NULL || !is_dbhashobject(dp)) {
-       err_badcall();
-       return NULL;
-    }
     if (!getnoarg(args))
        return NULL;
     list = newlistobject(0);