summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-31 13:46:00 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-31 13:46:00 (GMT)
commit3cd04aa1b2ddf27d089d5837c0d2e3ba34b02c5c (patch)
treebae14c13678b1348afe38f442945187a47bab51f /Python/_warnings.c
parentdb49bd60299b9141db17a1e702e5ca509228f508 (diff)
downloadcpython-3cd04aa1b2ddf27d089d5837c0d2e3ba34b02c5c.zip
cpython-3cd04aa1b2ddf27d089d5837c0d2e3ba34b02c5c.tar.gz
cpython-3cd04aa1b2ddf27d089d5837c0d2e3ba34b02c5c.tar.bz2
Issue #19437: Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
with an exception set
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 8d9666a..74ac8c6 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -144,11 +144,19 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno,
ln_obj = PyTuple_GET_ITEM(tmp_item, 4);
good_msg = check_matched(msg, text);
+ if (good_msg == -1)
+ return NULL;
+
good_mod = check_matched(mod, module);
+ if (good_mod == -1)
+ return NULL;
+
is_subclass = PyObject_IsSubclass(category, cat);
+ if (is_subclass == -1)
+ return NULL;
+
ln = PyLong_AsSsize_t(ln_obj);
- if (good_msg == -1 || good_mod == -1 || is_subclass == -1 ||
- (ln == -1 && PyErr_Occurred()))
+ if (ln == -1 && PyErr_Occurred())
return NULL;
if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln))