Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5262887

Browse filesBrowse files
committed
improve ref counting
1 parent 22ecb23 commit 5262887
Copy full SHA for 5262887

File tree

1 file changed

+4
-9
lines changed
Filter options

1 file changed

+4
-9
lines changed

‎Modules/pyexpat.c

Copy file name to clipboardExpand all lines: Modules/pyexpat.c
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,21 +1867,16 @@ pyexpat_exec(PyObject *mod)
18671867

18681868
/* Add some symbolic constants to the module */
18691869

1870-
Py_INCREF(state->error);
1871-
if (PyModule_AddObject(mod, "error", state->error) < 0) {
1872-
Py_DECREF(state->error);
1870+
if (PyModule_AddObjectRef(mod, "error", state->error) < 0) {
18731871
return -1;
18741872
}
1875-
Py_INCREF(state->error);
1876-
if (PyModule_AddObject(mod, "ExpatError", state->error) < 0) {
1877-
Py_DECREF(state->error);
1873+
1874+
if (PyModule_AddObjectRef(mod, "ExpatError", state->error) < 0) {
18781875
return -1;
18791876
}
18801877

1881-
Py_INCREF(state->xml_parse_type);
1882-
if (PyModule_AddObject(mod, "XMLParserType",
1878+
if (PyModule_AddObjectRef(mod, "XMLParserType",
18831879
(PyObject *) state->xml_parse_type) < 0) {
1884-
Py_DECREF(state->xml_parse_type);
18851880
return -1;
18861881
}
18871882

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.