]> granicus.if.org Git - python/commitdiff
Issue #3835: Refuse to use unthreaded Tcl in threaded Python.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 13 Mar 2012 20:59:15 +0000 (13:59 -0700)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 13 Mar 2012 20:59:15 +0000 (13:59 -0700)
Patch by Guilherme Polo and Andrew Svetlov.

Misc/NEWS
Modules/_tkinter.c

index 8e7ef6f5477b194e3c3a41bc53b02dc2505c2cfd..6d51cba8cf2b3dc3f830afecbe8dbc02a8425ea0 100644 (file)
--- 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
index abbe0ec7bbc5476fec3dc9085838cd470cedd3f5..94ae48d388a18c9b1017e4b86bb6feb2fa88e4cd 100644 (file)
@@ -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);