summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-02 06:47:27 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-02 06:47:27 (GMT)
commitf41f8f99744230beb78efca71033a288107e3547 (patch)
tree62fa8623dbe384de9d98319409a697f66a744c13 /Lib/test/test_exceptions.py
parenta7eaf56a6d1de20a7a36fde03b3512fa5f9f395d (diff)
downloadcpython-f41f8f99744230beb78efca71033a288107e3547.zip
cpython-f41f8f99744230beb78efca71033a288107e3547.tar.gz
cpython-f41f8f99744230beb78efca71033a288107e3547.tar.bz2
Issue #22977: Fixed formatting Windows error messages on Wine.
Patch by Martin Panter.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index b35a5e4..493cd2f 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -6,10 +6,11 @@ import unittest
import pickle
import weakref
import errno
+import ctypes
from test.support import (TESTFN, captured_output, check_impl_detail,
check_warnings, cpython_only, gc_collect, run_unittest,
- no_tracing, unlink)
+ no_tracing, unlink, get_attribute)
class NaiveException(Exception):
def __init__(self, x):
@@ -245,6 +246,13 @@ class ExceptionTests(unittest.TestCase):
self.assertEqual(w.strerror, 'foo')
self.assertEqual(w.filename, None)
+ def test_windows_message(self):
+ """Should fill in unknown error code in Windows error message"""
+ windll = get_attribute(ctypes, "windll")
+ code = int.from_bytes(b"\xE0msc", "big")
+ with self.assertRaisesRegex(OSError, hex(code)):
+ windll.kernel32.RaiseException(code, 0, 0, None)
+
def testAttributes(self):
# test that exception attributes are happy