Skip to content

Commit 8d44f36

Browse files
gh-83004: Clean up refleak in _io initialisation (GH-98840)
(cherry picked from commit 1208037) Co-authored-by: Shantanu <[email protected]>
1 parent 22bbb0c commit 8d44f36

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clean up refleak on failed module initialisation in :mod:`_io`.

Modules/_io/_iomodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,10 @@ PyInit__io(void)
718718
goto fail;
719719

720720
/* BlockingIOError, for compatibility */
721-
Py_INCREF(PyExc_BlockingIOError);
722-
if (PyModule_AddObject(m, "BlockingIOError",
723-
(PyObject *) PyExc_BlockingIOError) < 0)
721+
if (PyModule_AddObjectRef(m, "BlockingIOError",
722+
(PyObject *) PyExc_BlockingIOError) < 0) {
724723
goto fail;
724+
}
725725

726726
/* Concrete base types of the IO ABCs.
727727
(the ABCs themselves are declared through inheritance in io.py)

0 commit comments

Comments
 (0)