8000 bpo-40077: Convert _elementtree types to heap types by erlend-aasland · Pull Request #23428 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40077: Convert _elementtree types to heap types #23428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Prev Previous commit
Next Next commit
Use PyModule_AddObjectRef
  • Loading branch information
Erlend E. Aasland committed Jan 11, 2021
commit 404b398d69313a941b1dae753613f8066f00f4bd
5 changes: 3 additions & 2 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4366,7 +4366,9 @@ PyInit__elementtree(void)
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL
);
Py_INCREF(st->parseerror_obj);
if (PyModule_AddObject(m, "ParseError", st->parseerror_obj) < 0) {
int res = PyModule_AddObjectRef(m, "ParseError", st->parseerror_obj);
Py_DECREF(st->parseerror_obj);
if (res < 0) {
goto error;
}

Expand All @@ -4385,7 +4387,6 @@ PyInit__elementtree(void)
return m;

error:
Py_XDECREF(st->parseerror_obj);
Py_XDECREF(m);
return NULL;
}
0