(original) (raw)

changeset: 75599:d731dcda2611 user: Martin v. Löwis martin@v.loewis.de date: Tue Mar 13 13:59:15 2012 -0700 files: Misc/NEWS Modules/_tkinter.c description: Issue #3835: Refuse to use unthreaded Tcl in threaded Python. Patch by Guilherme Polo and Andrew Svetlov. diff -r 71041c0dedd5 -r d731dcda2611 Misc/NEWS --- a/Misc/NEWS Tue Mar 13 13:40:42 2012 -0700 +++ b/Misc/NEWS Tue Mar 13 13:59:15 2012 -0700 @@ -24,6 +24,8 @@ 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 -r 71041c0dedd5 -r d731dcda2611 Modules/_tkinter.c --- a/Modules/_tkinter.c Tue Mar 13 13:40:42 2012 -0700 +++ b/Modules/_tkinter.c Tue Mar 13 13:59:15 2012 -0700 @@ -613,6 +613,13 @@ } #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); /martin@v.loewis.de