From df50cebbed06731512543de7fb96137ecb453ab2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 13 Mar 2012 13:59:15 -0700 Subject: [PATCH] Issue #3835: Refuse to use unthreaded Tcl in threaded Python. Patch by Guilherme Polo and Andrew Svetlov. --- Misc/NEWS | 2 ++ Modules/_tkinter.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 8e7ef6f547..6d51cba8cf 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,8 @@ Core and Builtins Library ------- +- Issue #3835: Refuse to use unthreaded Tcl in threaded Python. + - Issue #2843: Add new Tk API to Tkinter. - Issue #14184: Increase the default stack size for secondary threads on diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index abbe0ec7bb..94ae48d388 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -613,6 +613,13 @@ Tkapp_New(char *screenName, char *className, } #endif #ifdef WITH_THREAD + if (!(v->threaded)) { + PyErr_SetString(PyExc_RuntimeError, + "Tcl/Tk was not compiled with --enable-threads but " + "Python has threads enabled"); + Py_DECREF(v); + return 0; + } if (v->threaded && tcl_lock) { /* If Tcl is threaded, we don't need the lock. */ PyThread_free_lock(tcl_lock); -- 2.40.0