diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-11-06 06:30:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 06:30:41 -0800 |
commit | 4b1e45e78b3f8bc9be7497311cfa36e762f43226 (patch) | |
tree | 699c65de26badd61dd71dfe998edeca3d4cdc333 /Modules | |
parent | gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148) (diff) | |
download | cpython-4b1e45e78b3f8bc9be7497311cfa36e762f43226.tar.gz cpython-4b1e45e78b3f8bc9be7497311cfa36e762f43226.tar.bz2 cpython-4b1e45e78b3f8bc9be7497311cfa36e762f43226.zip |
gh-83004: Clean up refleak in _zoneinfo initialisation (GH-98842)
(cherry picked from commit 31f2f6568d89564cc1d686cd6b75ba5578aaa748)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
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 1535721b026..55975f4e269 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -2652,8 +2652,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 */ PyObject *_tzpath_module = PyImport_ImportModule("zoneinfo._tzpath"); |