[Python-checkins] cpython (2.7): Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.

ned.deily python-checkins at python.org
Sun Nov 2 03:34:01 CET 2014


https://hg.python.org/cpython/rev/bd4dc351d670
changeset:   93342:bd4dc351d670
branch:      2.7
parent:      93338:28d18fdc52c4
user:        Ned Deily <nad at acm.org>
date:        Sat Nov 01 19:26:45 2014 -0700
summary:
  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)

files:
  Lib/test/test_support.py |  5 ++---
  Misc/NEWS                |  2 ++
  2 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -326,12 +326,11 @@
                 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -277,6 +277,8 @@
 - 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
 -----
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list