diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2022-11-06 14:04:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 14:04:36 (GMT) |
commit | 31f2f6568d89564cc1d686cd6b75ba5578aaa748 (patch) | |
tree | 41af12932c419a0ecb1347558f86ec298cb46683 /Modules | |
parent | 99e2e60cb25bfcf77ba1386d331cfa85864e6a65 (diff) | |
download | cpython-31f2f6568d89564cc1d686cd6b75ba5578aaa748.zip cpython-31f2f6568d89564cc1d686cd6b75ba5578aaa748.tar.gz cpython-31f2f6568d89564cc1d686cd6b75ba5578aaa748.tar.bz2 |
gh-83004: Clean up refleak in _zoneinfo initialisation (#98842)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_zoneinfo.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 36b25bf..9986b91 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -2657,8 +2657,9 @@ zoneinfomodule_exec(PyObject *m) goto error; } - Py_INCREF(&PyZoneInfo_ZoneInfoType); - PyModule_AddObject(m, "ZoneInfo", (PyObject *)&PyZoneInfo_ZoneInfoType); + if (PyModule_AddObjectRef(m, "ZoneInfo", (PyObject *)&PyZoneInfo_ZoneInfoType) < 0) { + goto error; + } /* Populate imports */ _tzpath_find_tzfile = |