diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-09-17 11:23:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-17 11:23:31 (GMT) |
commit | add16f1a5e4013f97d33cc677dc008e8199f5b11 (patch) | |
tree | 2c187adbae2766f942e35780950a526dfe84ff48 /Modules/_elementtree.c | |
parent | e57ecf6bbc59f999d27b125ea51b042c24a07bd9 (diff) | |
download | cpython-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.c | 3 |
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); |