[Python-checkins] Cleanup dangling reference in get_timezone_utc_capi (#5317)

Victor Stinner webhook-mailer at python.org
Thu Jan 25 08:58:10 EST 2018


https://github.com/python/cpython/commit/58dc03c737a71de93edef7723c9f6186116288ef
commit: 58dc03c737a71de93edef7723c9f6186116288ef
branch: master
author: Paul Ganssle <pganssle at users.noreply.github.com>
committer: Victor Stinner <victor.stinner at gmail.com>
date: 2018-01-25T14:58:07+01:00
summary:

Cleanup dangling reference in get_timezone_utc_capi (#5317)

files:
M Modules/_testcapimodule.c

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;
     }
 }



More information about the Python-checkins mailing list