summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-17 11:23:31 (GMT)
committerGitHub <noreply@github.com>2023-09-17 11:23:31 (GMT)
commitadd16f1a5e4013f97d33cc677dc008e8199f5b11 (patch)
tree2c187adbae2766f942e35780950a526dfe84ff48 /Modules/_elementtree.c
parente57ecf6bbc59f999d27b125ea51b042c24a07bd9 (diff)
downloadcpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.zip
cpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.tar.gz
cpython-add16f1a5e4013f97d33cc677dc008e8199f5b11.tar.bz2
gh-108511: Add C API functions which do not silently ignore errors (GH-109025)
Add the following functions: * PyObject_HasAttrWithError() * PyObject_HasAttrStringWithError() * PyMapping_HasKeyWithError() * PyMapping_HasKeyStringWithError()
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 8cb57e6..f9d5793 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3532,12 +3532,11 @@ expat_start_doctype_handler(XMLParserObject *self,
sysid_obj, NULL);
Py_XDECREF(res);
}
- else if (PyObject_GetOptionalAttr((PyObject *)self, st->str_doctype, &res) > 0) {
+ else if (PyObject_HasAttrWithError((PyObject *)self, st->str_doctype) > 0) {
(void)PyErr_WarnEx(PyExc_RuntimeWarning,
"The doctype() method of XMLParser is ignored. "
"Define doctype() method on the TreeBuilder target.",
1);
- Py_DECREF(res);
}
Py_DECREF(doctype_name_obj);