summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2014-11-02 02:29:22 (GMT)
committerNed Deily <nad@acm.org>2014-11-02 02:29:22 (GMT)
commit91f01e175a4f8f21893401573bdc36c5004388dd (patch)
tree53a121b0ff45afa7115f5b1fc9af64d14ac4f2d0 /Lib/test/support
parentaa3ea7ee78f35f1b88801b6a00833dcae384dc37 (diff)
downloadcpython-91f01e175a4f8f21893401573bdc36c5004388dd.zip
cpython-91f01e175a4f8f21893401573bdc36c5004388dd.tar.gz
cpython-91f01e175a4f8f21893401573bdc36c5004388dd.tar.bz2
Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
When running tests in subprocesses with the regrtest -j option, a bug in Cocoa Tk can result in a Tcl segfault. Avoid the problem by forcing Tk to fully initialize as an OS X gui process before destroying the Tcl instance and creating another. (Original patch by Serhiy Storchaka)
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index adebedd..a64ed56 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -461,12 +461,11 @@ def _is_gui_available():
reason = "cannot run without OS X gui process"
# check on every platform whether tkinter can actually do anything
- # but skip the test on OS X because it can cause segfaults in Cocoa Tk
- # when running regrtest with the -j option (multiple threads/subprocesses)
- if (not reason) and (sys.platform != 'darwin'):
+ if not reason:
try:
from tkinter import Tk
root = Tk()
+ root.update()
root.destroy()
except Exception as e:
err_string = str(e)