Commit b942d28b authored by Guido van Rossum's avatar Guido van Rossum

Quick fixes for assert failures in dbm wrapper code.

parent 806c2469
...@@ -103,8 +103,7 @@ dbm_subscript(dbmobject *dp, register PyObject *key) ...@@ -103,8 +103,7 @@ dbm_subscript(dbmobject *dp, register PyObject *key)
check_dbmobject_open(dp); check_dbmobject_open(dp);
drec = dbm_fetch(dp->di_dbm, krec); drec = dbm_fetch(dp->di_dbm, krec);
if ( drec.dptr == 0 ) { if ( drec.dptr == 0 ) {
PyErr_SetString(PyExc_KeyError, PyErr_SetObject(PyExc_KeyError, key);
PyString_AS_STRING((PyStringObject *)key));
return NULL; return NULL;
} }
if ( dbm_error(dp->di_dbm) ) { if ( dbm_error(dp->di_dbm) ) {
...@@ -135,8 +134,7 @@ dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w) ...@@ -135,8 +134,7 @@ dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w)
if (w == NULL) { if (w == NULL) {
if ( dbm_delete(dp->di_dbm, krec) < 0 ) { if ( dbm_delete(dp->di_dbm, krec) < 0 ) {
dbm_clearerr(dp->di_dbm); dbm_clearerr(dp->di_dbm);
PyErr_SetString(PyExc_KeyError, PyErr_SetString(PyExc_KeyError, v);
PyString_AS_STRING((PyStringObject *)v));
return -1; return -1;
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment