diff options
author | Victor Stinner <vstinner@python.org> | 2024-06-06 15:31:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 15:31:33 (GMT) |
commit | 78634cfa3dd4b542897835d5f097604dbeb0f3fd (patch) | |
tree | 77d7f30ed8fda1f17af7536fd594c02cdeaa1f0e /Modules/_tkinter.c | |
parent | cccc9f63c63ae693ccd0e2d8fc6cfd3aa18feb8e (diff) | |
download | cpython-78634cfa3dd4b542897835d5f097604dbeb0f3fd.zip cpython-78634cfa3dd4b542897835d5f097604dbeb0f3fd.tar.gz cpython-78634cfa3dd4b542897835d5f097604dbeb0f3fd.tar.bz2 |
gh-120155: Initialize variables in _tkinter.c (#120156)
Initialize variables in _tkinter.c to make static analyzers happy.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r-- | Modules/_tkinter.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 24f87c8..a34646a 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1438,7 +1438,7 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) marshal the parameters to the interpreter thread. */ Tkapp_CallEvent *ev; Tcl_Condition cond = NULL; - PyObject *exc; + PyObject *exc = NULL; // init to make static analyzers happy if (!WaitForMainloop(self)) return NULL; ev = (Tkapp_CallEvent*)attemptckalloc(sizeof(Tkapp_CallEvent)); @@ -1712,7 +1712,8 @@ var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags) TkappObject *self = (TkappObject*)selfptr; if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { VarEvent *ev; - PyObject *res, *exc; + // init 'res' and 'exc' to make static analyzers happy + PyObject *res = NULL, *exc = NULL; Tcl_Condition cond = NULL; /* The current thread is not the interpreter thread. Marshal @@ -2413,6 +2414,8 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, data->self = self; data->func = Py_NewRef(func); if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { + err = 0; // init to make static analyzers happy + Tcl_Condition cond = NULL; CommandEvent *ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent)); if (ev == NULL) { @@ -2468,6 +2471,8 @@ _tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name) TRACE(self, ("((sss))", "rename", name, "")); if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { + err = 0; // init to make static analyzers happy + Tcl_Condition cond = NULL; CommandEvent *ev; ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent)); |