gh-83004: Clean up refleak in _zoneinfo initialisation (GH-98842)

(cherry picked from commit 31f2f6568d)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-11-06 06:38:26 -08:00 committed by GitHub
parent 92cc215518
commit 70006d6a5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1 @@
Clean up refleak on failed module initialisation in :mod:`_zoneinfo`

View file

@ -2648,8 +2648,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");