diff options
author | Guido van Rossum <guido@python.org> | 1995-07-18 18:33:09 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-07-18 18:33:09 (GMT) |
commit | cf1025ba0db6a251b2fa681cc95eaa7490a60cb3 (patch) | |
tree | 1939c0d6b0168260146b29f1ace6448a638a63b9 | |
parent | 79ae53e8f0a311fce6e8d1b1b98b9efcfe016808 (diff) | |
download | cpython-cf1025ba0db6a251b2fa681cc95eaa7490a60cb3.zip cpython-cf1025ba0db6a251b2fa681cc95eaa7490a60cb3.tar.gz cpython-cf1025ba0db6a251b2fa681cc95eaa7490a60cb3.tar.bz2 |
fixed arg checking for keys() and close()
-rw-r--r-- | Modules/dbhashmodule.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Modules/dbhashmodule.c b/Modules/dbhashmodule.c index 324f928..e04cebc 100644 --- a/Modules/dbhashmodule.c +++ b/Modules/dbhashmodule.c @@ -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; @@ -213,6 +198,25 @@ static mapping_methods dbhash_as_mapping = { }; 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; object *args; @@ -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); |