]> granicus.if.org Git - python/commitdiff
Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
authorNed Deily <nad@acm.org>
Sun, 2 Nov 2014 02:26:45 +0000 (19:26 -0700)
committerNed Deily <nad@acm.org>
Sun, 2 Nov 2014 02:26:45 +0000 (19:26 -0700)
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)

Lib/test/test_support.py
Misc/NEWS

index 26b8e444b91f012f80a89f9200f8bde762ad1eb9..f4434595e8cfcff16e59e5c881e4e69e13136e52 100644 (file)
@@ -326,12 +326,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)
index 97aa75f8b52c1ab7821b986a3c6ce8ce03f6fb42..c60917fcd091ff992856cc84ced251df71cba4df 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -277,6 +277,8 @@ Tests
 - Issue #21976: Fix test_ssl to accept LibreSSL version strings.  Thanks
   to William Orr.
 
+- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
+
 Build
 -----