mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fixing #880531: raise TypeError when trying to use a None key with RECNO
or QUEUE database.
This commit is contained in:
parent
c83dddf7fe
commit
024f2de05f
1 changed files with 7 additions and 0 deletions
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue