From 58dc03c737a71de93edef7723c9f6186116288ef Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Thu, 25 Jan 2018 08:58:07 -0500 Subject: [PATCH] Cleanup dangling reference in get_timezone_utc_capi (#5317) --- Modules/_testcapimodule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 3f41134a345..2ad4322ecaa 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2300,8 +2300,10 @@ get_timezone_utc_capi(PyObject* self, PyObject *args) { return NULL; } if (macro) { + Py_INCREF(PyDateTime_TimeZone_UTC); return PyDateTime_TimeZone_UTC; } else { + Py_INCREF(PyDateTimeAPI->TimeZone_UTC); return PyDateTimeAPI->TimeZone_UTC; } }