Kaydet (Commit) 3cd04aa1 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #19437: Fix get_filter() from _warnings, don't call PyObject_IsSubclass()

with an exception set
üst db49bd60
...@@ -144,11 +144,19 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, ...@@ -144,11 +144,19 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno,
ln_obj = PyTuple_GET_ITEM(tmp_item, 4); ln_obj = PyTuple_GET_ITEM(tmp_item, 4);
good_msg = check_matched(msg, text); good_msg = check_matched(msg, text);
if (good_msg == -1)
return NULL;
good_mod = check_matched(mod, module); good_mod = check_matched(mod, module);
if (good_mod == -1)
return NULL;
is_subclass = PyObject_IsSubclass(category, cat); is_subclass = PyObject_IsSubclass(category, cat);
if (is_subclass == -1)
return NULL;
ln = PyLong_AsSsize_t(ln_obj); ln = PyLong_AsSsize_t(ln_obj);
if (good_msg == -1 || good_mod == -1 || is_subclass == -1 || if (ln == -1 && PyErr_Occurred())
(ln == -1 && PyErr_Occurred()))
return NULL; return NULL;
if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment