summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-11 07:27:50 (GMT)
committerGitHub <noreply@github.com>2018-12-11 07:27:50 (GMT)
commit8855d9339858683c9b4fcd50b02a7bca526d4726 (patch)
tree3c85fc696f92556807f1031f9653ed3b73d70561 /Python/_warnings.c
parent37607f26697351751165a042f91f04530ce333f7 (diff)
downloadcpython-8855d9339858683c9b4fcd50b02a7bca526d4726.zip
cpython-8855d9339858683c9b4fcd50b02a7bca526d4726.tar.gz
cpython-8855d9339858683c9b4fcd50b02a7bca526d4726.tar.bz2
[3.6] bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077) (GH-11106)
(cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6)
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)