summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-07 16:37:13 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-07 16:37:13 (GMT)
commite846342f8ada25055fe1b9bcec407fe82e2c3f8e (patch)
tree2d5713c5b68a4b618c60b6d2ec5ae0c89797c2b4 /Lib
parent7d82c8621bb72035b2e36388d616533dacfc2e43 (diff)
downloadcpython-e846342f8ada25055fe1b9bcec407fe82e2c3f8e.zip
cpython-e846342f8ada25055fe1b9bcec407fe82e2c3f8e.tar.gz
cpython-e846342f8ada25055fe1b9bcec407fe82e2c3f8e.tar.bz2
#11732: make suppress_crash_popup() work on Windows XP and Windows Server 2003.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index ba1206c..19989ac 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -1911,10 +1911,12 @@ if sys.platform.startswith('win'):
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