From b942d28bf5b62e1823b91a7b3986e120ec9763bc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 7 Aug 2007 00:13:33 +0000 Subject: Quick fixes for assert failures in dbm wrapper code. --- Modules/dbmmodule.c | 6 ++---- 1 file 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 { -- cgit v0.12