summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-06 11:18:24 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-06 11:18:24 (GMT)
commitf0b311bd739d36d62e81dacd27d098c496e8663a (patch)
treebebf1eae03e8b2e8687ec4952afd6e71245baddd /Modules/_collectionsmodule.c
parent873305b28cbe11f192c6d4120405f629f1b18e1c (diff)
downloadcpython-f0b311bd739d36d62e81dacd27d098c496e8663a.zip
cpython-f0b311bd739d36d62e81dacd27d098c496e8663a.tar.gz
cpython-f0b311bd739d36d62e81dacd27d098c496e8663a.tar.bz2
Issue #28123: _PyDict_GetItem_KnownHash() now can raise an exception as
PyDict_GetItemWithError(). Patch by Xiang Zhang.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r--Modules/_collectionsmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 9ed6f14b..6608798 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -2300,6 +2300,8 @@ _count_elements(PyObject *self, PyObject *args)
oldval = _PyDict_GetItem_KnownHash(mapping, key, hash);
if (oldval == NULL) {
+ if (PyErr_Occurred())
+ goto done;
if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) < 0)
goto done;
} else {