diff options
-rw-r--r-- | Modules/dbmmodule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c index ee75fd6..816251a 100644 --- a/Modules/dbmmodule.c +++ b/Modules/dbmmodule.c @@ -103,8 +103,7 @@ dbm_subscript(dbmobject *dp, register PyObject *key) check_dbmobject_open(dp); drec = dbm_fetch(dp->di_dbm, krec); if ( drec.dptr == 0 ) { - PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)key)); + PyErr_SetObject(PyExc_KeyError, key); return NULL; } if ( dbm_error(dp->di_dbm) ) { @@ -135,8 +134,7 @@ dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w) if (w == NULL) { if ( dbm_delete(dp->di_dbm, krec) < 0 ) { dbm_clearerr(dp->di_dbm); - PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)v)); + PyErr_SetString(PyExc_KeyError, v); return -1; } } else { |