summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2014-11-01 19:29:22 -0700
committerNed Deily <nad@acm.org>2014-11-01 19:29:22 -0700
commit31ef9f7a719949750f5c12efe21ff3efea83e63a (patch)
treedebff1bd76ab3df11b239aff5b1c7a6e40851960
parent7eb6b0ce74a8951a936bf4107583e619d21f1ef9 (diff)
downloadcpython-31ef9f7a719949750f5c12efe21ff3efea83e63a.tar.gz
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)
-rw-r--r--Lib/test/support/__init__.py5
-rw-r--r--Misc/NEWS2
2 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index adebeddbd9..a64ed56299 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)
diff --git a/Misc/NEWS b/Misc/NEWS
index b541e16095..c52aa62efd 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -113,6 +113,8 @@ Tests
- Issue #21456: Skip two tests in test_urllib2net.py if _ssl module not
present. Patch by Remi Pointel.
+- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
+
Build
-----