Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review: fix error handling in module init
  • Loading branch information
erlend-aasland committed Jan 19, 2023
commit 730e5d25bc9f3cbd7ca89b2d67dcb68d0240a457
18 changes: 9 additions & 9 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4266,41 +4266,41 @@ PyInit__elementtree(void)

st->str_append = PyUnicode_InternFromString("append");
Comment thread
erlend-aasland marked this conversation as resolved.
if (st->str_append == NULL) {
return NULL;
goto error;
}
st->str_find = PyUnicode_InternFromString("find");
if (st->str_find == NULL) {
return NULL;
goto error;
}
st->str_findall = PyUnicode_InternFromString("findall");
if (st->str_findall == NULL) {
return NULL;
goto error;
}
st->str_findtext = PyUnicode_InternFromString("findtext");
if (st->str_findtext == NULL) {
return NULL;
goto error;
}
st->str_iterfind = PyUnicode_InternFromString("iterfind");
if (st->str_iterfind == NULL) {
return NULL;
goto error;
}
st->str_tail = PyUnicode_InternFromString("tail");
if (st->str_tail == NULL) {
return NULL;
goto error;
}
st->str_text = PyUnicode_InternFromString("text");
if (st->str_text == NULL) {
return NULL;
goto error;
}
st->str_doctype = PyUnicode_InternFromString("doctype");
if (st->str_doctype == NULL) {
return NULL;
goto error;
}
st->parseerror_obj = PyErr_NewException(
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL
);
if (PyModule_AddObjectRef(m, "ParseError", st->parseerror_obj) < 0) {
return NULL;
goto error;
}

PyTypeObject *types[] = {
Expand Down