Skip to content

Commit

Permalink
pythongh-83004: Clean up refleak in _zoneinfo initialisation (pythonG…
Browse files Browse the repository at this point in the history
…H-98842)

(cherry picked from commit 31f2f65)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
  • Loading branch information
hauntsaninja authored and miss-islington committed Nov 6, 2022
1 parent 92cc215 commit 7cf8db3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clean up refleak on failed module initialisation in :mod:`_zoneinfo`
5 changes: 3 additions & 2 deletions Modules/_zoneinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 7cf8db3

Please sign in to comment.