]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* Objects/mappingobject.c (mappingremove): don't call
authorGuido van Rossum <guido@python.org>
Mon, 2 Jan 1995 19:42:39 +0000 (19:42 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 2 Jan 1995 19:42:39 +0000 (19:42 +0000)
lookmapping() for empty dictionary

Objects/dictobject.c
Objects/mappingobject.c

index 89fd314ef4b52ceb856f78c3b1fc83b91e3bf9e2..bb4e051b1c7726de138f84be5c6f9a036284fee7 100644 (file)
@@ -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;
        }
index 89fd314ef4b52ceb856f78c3b1fc83b91e3bf9e2..bb4e051b1c7726de138f84be5c6f9a036284fee7 100644 (file)
@@ -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;
        }