[Python-checkins] cpython (3.3): #11732: make suppress_crash_popup() work on Windows XP and Windows Server 2003.

ezio.melotti python-checkins at python.org
Thu Mar 7 17:39:11 CET 2013


http://hg.python.org/cpython/rev/6ccefddc13fd
changeset:   82525:6ccefddc13fd
branch:      3.3
parent:      82523:adeafab9a18f
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Thu Mar 07 18:37:13 2013 +0200
summary:
  #11732: make suppress_crash_popup() work on Windows XP and Windows Server 2003.

files:
  Lib/test/support.py |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Lib/test/support.py b/Lib/test/support.py
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -1911,10 +1911,12 @@
     def suppress_crash_popup():
         """Disable Windows Error Reporting dialogs using SetErrorMode."""
         # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
+        # GetErrorMode is not available on Windows XP and Windows Server 2003,
+        # but SetErrorMode returns the previous value, so we can use that
         import ctypes
         k32 = ctypes.windll.kernel32
-        old_error_mode = k32.GetErrorMode()
         SEM_NOGPFAULTERRORBOX = 0x02
+        old_error_mode = k32.SetErrorMode(SEM_NOGPFAULTERRORBOX)
         k32.SetErrorMode(old_error_mode | SEM_NOGPFAULTERRORBOX)
         try:
             yield

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


More information about the Python-checkins mailing list