summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e96e154..3ae68bb 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -248,7 +248,11 @@ already_warned(PyObject *registry, PyObject *key, int should_set)
version_obj = _PyDict_GetItemId(registry, &PyId_version);
if (version_obj == NULL
|| !PyLong_CheckExact(version_obj)
- || PyLong_AsLong(version_obj) != _filters_version) {
+ || PyLong_AsLong(version_obj) != _filters_version)
+ {
+ if (PyErr_Occurred()) {
+ return -1;
+ }
PyDict_Clear(registry);
version_obj = PyLong_FromLong(_filters_version);
if (version_obj == NULL)