diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-01-20 15:14:55 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-01-20 15:14:55 (GMT) |
commit | 024f2de05f1dc5b8573f98426aa11bb9b07cc55e (patch) | |
tree | afca611fc186f0d1fc6f6bec56fb86cb204aa7f1 | |
parent | c83dddf7fe7449d13435874da973c04946650a3d (diff) | |
download | cpython-024f2de05f1dc5b8573f98426aa11bb9b07cc55e.zip cpython-024f2de05f1dc5b8573f98426aa11bb9b07cc55e.tar.gz cpython-024f2de05f1dc5b8573f98426aa11bb9b07cc55e.tar.bz2 |
Fixing #880531: raise TypeError when trying to use a None key with RECNO
or QUEUE database.
-rw-r--r-- | Modules/_bsddb.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index b86cd78..ba6af27 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -349,6 +349,13 @@ make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags) CLEAR_DBT(*key); if (keyobj == Py_None) { /* TODO: is None really okay for keys? */ + type = _DB_get_type(self); + if (type == DB_RECNO || type == DB_QUEUE) { + PyErr_SetString( + PyExc_TypeError, + "None keys not allowed for Recno and Queue DB's"); + return 0; + } /* no need to do anything, the structure has already been zeroed */ } |