Skip to content

Commit 1208037

Browse files
authored
gh-83004: Clean up refleak in _io initialisation (#98840)
1 parent 8c4de57 commit 1208037

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,10 @@ PyInit__io(void)
703703
goto fail;
704704

705705
/* BlockingIOError, for compatibility */
706-
Py_INCREF(PyExc_BlockingIOError);
707-
if (PyModule_AddObject(m, "BlockingIOError",
708-
(PyObject *) PyExc_BlockingIOError) < 0)
706+
if (PyModule_AddObjectRef(m, "BlockingIOError",
707+
(PyObject *) PyExc_BlockingIOError) < 0) {
709708
goto fail;
709+
}
710710

711711
// Set type base classes
712712
PyFileIO_Type.tp_base = &PyRawIOBase_Type;

0 commit comments

Comments
 (0)