8000 gh-83004: Clean up refleak in _zoneinfo initialisation (#98842) · python/cpython@31f2f65 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31f2f65

Browse files
authored
gh-83004: Clean up refleak in _zoneinfo initialisation (#98842)
1 parent 99e2e60 commit 31f2f65

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
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:`_zoneinfo`

Modules/_zoneinfo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,8 +2657,9 @@ zoneinfomodule_exec(PyObject *m)
26572657
goto error;
26582658
}
26592659

2660-
Py_INCREF(&PyZoneInfo_ZoneInfoType);
2661-
PyModule_AddObject(m, "ZoneInfo", (PyObject *)&PyZoneInfo_ZoneInfoType);
2660+
if (PyModule_AddObjectRef(m, "ZoneInfo", (PyObject *)&PyZoneInfo_ZoneInfoType) < 0) {
2661+
goto error;
2662+
}
26622663

26632664
/* Populate imports */
26642665
_tzpath_find_tzfile =

0 commit comments

Comments
 (0)
0