[Python-checkins] bpo-38823: Clean up refleaks in _tkinter initialization. (GH-17206)

Miss Islington (bot) webhook-mailer at python.org
Mon Nov 18 10:10:35 EST 2019


https://github.com/python/cpython/commit/42a4359390b78b3360e100fc9c075495e48354b2
commit: 42a4359390b78b3360e100fc9c075495e48354b2
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-11-18T07:10:31-08:00
summary:

bpo-38823: Clean up refleaks in _tkinter initialization. (GH-17206)


https://bugs.python.org/issue38823
(cherry picked from commit 289cf0fbf78c4f38c38ac71ac8b772be7ec2672f)

Co-authored-by: Brandt Bucher <brandtbucher at gmail.com>

files:
M Modules/_tkinter.c

diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index b622c158a48fa..a1071e5a5812f 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -3549,11 +3549,13 @@ PyInit__tkinter(void)
             if (!ret && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
                 str_path = _get_tcl_lib_path();
                 if (str_path == NULL && PyErr_Occurred()) {
+                    Py_DECREF(m);
                     return NULL;
                 }
                 if (str_path != NULL) {
                     wcs_path = PyUnicode_AsWideCharString(str_path, NULL);
                     if (wcs_path == NULL) {
+                        Py_DECREF(m);
                         return NULL;
                     }
                     SetEnvironmentVariableW(L"TCL_LIBRARY", wcs_path);



More information about the Python-checkins mailing list