Skip to content

Commit 58dc03c

Browse files
pgansslevstinner
authored andcommitted
Cleanup dangling reference in get_timezone_utc_capi (#5317)
1 parent 2812d3d commit 58dc03c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_testcapimodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,8 +2300,10 @@ get_timezone_utc_capi(PyObject* self, PyObject *args) {
23002300
return NULL;
23012301
}
23022302
if (macro) {
2303+
Py_INCREF(PyDateTime_TimeZone_UTC);
23032304
return PyDateTime_TimeZone_UTC;
23042305
} else {
2306+
Py_INCREF(PyDateTimeAPI->TimeZone_UTC);
23052307
return PyDateTimeAPI->TimeZone_UTC;
23062308
}
23072309
}

0 commit comments

Comments
 (0)