Skip to content

Commit 54e5fad

Browse files
author
Michiel de Hoon
committed
gh-140494: Remove dead code ifndef TCL_THREADS, which is always defined
1 parent 669299b commit 54e5fad

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

Modules/_tkinter.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Copyright (C) 1994 Steen Lumholt.
4040
#define CHECK_SIZE(size, elemsize) \
4141
((size_t)(size) <= Py_MIN((size_t)INT_MAX, UINT_MAX / (size_t)(elemsize)))
4242

43-
/* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
43+
/* If Tcl is compiled for threads, we must also define TCL_THREADS. We define
4444
it always; if Tcl is not threaded, the thread functions in
4545
Tcl are empty. */
4646
#define TCL_THREADS
@@ -283,21 +283,16 @@ Tkinter_TkInit(Tcl_Interp *interp)
283283
the command invocation will block.
284284
285285
In addition, for a threaded Tcl, a single global tcl_tstate won't
286-
be sufficient anymore, since multiple Tcl interpreters may
287-
simultaneously dispatch in different threads. So we use the Tcl TLS
288-
API.
286+
be sufficient, since multiple Tcl interpreters may simultaneously
287+
dispatch in different threads. So we use the Tcl TLS API.
289288
290289
*/
291290

292291
static PyThread_type_lock tcl_lock = 0;
293292

294-
#ifdef TCL_THREADS
295293
static Tcl_ThreadDataKey state_key;
296294
#define tcl_tstate \
297295
(*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
298-
#else
299-
static PyThreadState *tcl_tstate = NULL;
300-
#endif
301296

302297
#define ENTER_TCL \
303298
{ PyThreadState *tstate = PyThreadState_Get(); \
@@ -642,14 +637,6 @@ Tkapp_New(const char *screenName, const char *className,
642637
v->dispatching = 0;
643638
v->trace = NULL;
644639

645-
#ifndef TCL_THREADS
646-
if (v->threaded) {
647-
PyErr_SetString(PyExc_RuntimeError,
648-
"Tcl is threaded but _tkinter is not");
649-
Py_DECREF(v);
650-
return 0;
651-
}
652-
#endif
653640
if (v->threaded && tcl_lock) {
654641
/* If Tcl is threaded, we don't need the lock. */
655642
PyThread_free_lock(tcl_lock);

0 commit comments

Comments
 (0)