From: Guido van Rossum Date: Mon, 2 Jan 1995 19:42:39 +0000 (+0000) Subject: * Objects/mappingobject.c (mappingremove): don't call X-Git-Tag: v1.2b1~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efc8713428b1f132c7d4bdf849593eb3684e7586;p=thirdparty%2FPython%2Fcpython.git * Objects/mappingobject.c (mappingremove): don't call lookmapping() for empty dictionary --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 89fd314ef4b5..bb4e051b1c77 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -322,8 +322,11 @@ mappingremove(op, key) if (hash == -1) return -1; mp = (mappingobject *)op; + if (((mappingobject *)op)->ma_table == NULL) + goto empty; ep = lookmapping(mp, key, hash); if (ep->me_value == NULL) { + empty: err_setval(KeyError, key); return -1; } diff --git a/Objects/mappingobject.c b/Objects/mappingobject.c index 89fd314ef4b5..bb4e051b1c77 100644 --- a/Objects/mappingobject.c +++ b/Objects/mappingobject.c @@ -322,8 +322,11 @@ mappingremove(op, key) if (hash == -1) return -1; mp = (mappingobject *)op; + if (((mappingobject *)op)->ma_table == NULL) + goto empty; ep = lookmapping(mp, key, hash); if (ep->me_value == NULL) { + empty: err_setval(KeyError, key); return -1; }