summaryrefslogtreecommitdiffstats
path: root/Python/modsupport.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-04-16 00:02:32 (GMT)
committerGuido van Rossum <guido@python.org>2001-04-16 00:02:32 (GMT)
commite04eaec5b60a41b114dd3b7d78c3a389f8534af8 (patch)
tree4ae2adec9e51d0a2e81e63a99cb24c09ce7ab309 /Python/modsupport.c
parenta4dd011259fa6f3079bd0efd95b3a136c0e3c190 (diff)
downloadcpython-e04eaec5b60a41b114dd3b7d78c3a389f8534af8.zip
cpython-e04eaec5b60a41b114dd3b7d78c3a389f8534af8.tar.gz
cpython-e04eaec5b60a41b114dd3b7d78c3a389f8534af8.tar.bz2
Tim pointed out a remaining vulnerability in popitem(): the
PyTuple_New() could *conceivably* clear the dict, so move the test for an empty dict after the tuple allocation. It means that we waste time allocating and deallocating a 2-tuple when the dict is empty, but who cares. It also means that when the dict is empty *and* there's no memory to allocate a 2-tuple, we raise MemoryError, not KeyError -- but that may actually a good idea: if there's no room for a lousy 2-tuple, what are the chances that there's room for a KeyError instance?
Diffstat (limited to 'Python/modsupport.c')
0 files changed, 0 insertions, 0 deletions