]> 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:29:22 +0000 (19:29 -0700)
committerNed Deily <nad@acm.org>
Sun, 2 Nov 2014 02:29:22 +0000 (19:29 -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/support/__init__.py
Misc/NEWS

index adebeddbd98fabdd4d1b25c5bf6413a506c5554e..a64ed56299e1c2f02985d859fd5a8b5827626d80 100644 (file)
@@ -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)
index b541e160954e46811da1f8739041125d83ff94f3..c52aa62efddb888dd1f15a7dc4b6fba209fb5411 100644 (file)
--- 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
 -----