-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Open
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-tkintertype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)
Description
Bug report
Bug description:
Modules/_tkinter.c always defines TCL_THREADS:
/* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
it always; if Tcl is not threaded, the thread functions in
Tcl are empty. */
#define TCL_THREADSbut in two places in Modules/_tkinter.c , we check if TCL_THREADS is defined:
#ifdef TCL_THREADS
static Tcl_ThreadDataKey state_key;
typedef PyThreadState *ThreadSpecificData;
#define tcl_tstate \
(*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
#else
static PyThreadState *tcl_tstate = NULL;
#endifand
#ifndef TCL_THREADS
if (v->threaded) {
PyErr_SetString(PyExc_RuntimeError,
"Tcl is threaded but _tkinter is not");
Py_DECREF(v);
return 0;
}
#endifEspecially the latter is confusing, as this code block is not compiled and the test is never executed.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-tkintertype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)