[Python-checkins] cpython: Issue #19437: Fix get_filter() from _warnings, don't call PyObject_IsSubclass()

victor.stinner python-checkins at python.org
Thu Oct 31 17:23:52 CET 2013


http://hg.python.org/cpython/rev/9b37fbda9043
changeset:   86801:9b37fbda9043
parent:      86799:2a996cecf762
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 14:46:00 2013 +0100
summary:
  Issue #19437: Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
with an exception set

files:
  Python/_warnings.c |  12 ++++++++++--
  1 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -144,11 +144,19 @@
         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))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list