* Objects/mappingobject.c (mappingremove): don't call
lookmapping() for empty dictionary
This commit is contained in:
parent
3bbc62e9c2
commit
efc8713428
|
@ -322,8 +322,11 @@ mappingremove(op, key)
|
||||||
if (hash == -1)
|
if (hash == -1)
|
||||||
return -1;
|
return -1;
|
||||||
mp = (mappingobject *)op;
|
mp = (mappingobject *)op;
|
||||||
|
if (((mappingobject *)op)->ma_table == NULL)
|
||||||
|
goto empty;
|
||||||
ep = lookmapping(mp, key, hash);
|
ep = lookmapping(mp, key, hash);
|
||||||
if (ep->me_value == NULL) {
|
if (ep->me_value == NULL) {
|
||||||
|
empty:
|
||||||
err_setval(KeyError, key);
|
err_setval(KeyError, key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,8 +322,11 @@ mappingremove(op, key)
|
||||||
if (hash == -1)
|
if (hash == -1)
|
||||||
return -1;
|
return -1;
|
||||||
mp = (mappingobject *)op;
|
mp = (mappingobject *)op;
|
||||||
|
if (((mappingobject *)op)->ma_table == NULL)
|
||||||
|
goto empty;
|
||||||
ep = lookmapping(mp, key, hash);
|
ep = lookmapping(mp, key, hash);
|
||||||
if (ep->me_value == NULL) {
|
if (ep->me_value == NULL) {
|
||||||
|
empty:
|
||||||
err_setval(KeyError, key);
|
err_setval(KeyError, key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue