summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2022-11-06 14:04:36 (GMT)
committerGitHub <noreply@github.com>2022-11-06 14:04:36 (GMT)
commit31f2f6568d89564cc1d686cd6b75ba5578aaa748 (patch)
tree41af12932c419a0ecb1347558f86ec298cb46683 /Modules
parent99e2e60cb25bfcf77ba1386d331cfa85864e6a65 (diff)
downloadcpython-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.c5
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 =