WindowsError.str should display the windows error code,
not the posix error code; with test.
Fixes #1576174.
Will backport to release25-maint.
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 585d6fe..79fcee3 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -183,6 +183,19 @@
test_capi1()
test_capi2()
+ def test_WindowsError(self):
+ try:
+ WindowsError
+ except NameError:
+ pass
+ else:
+ self.failUnlessEqual(str(WindowsError(1001)),
+ "1001")
+ self.failUnlessEqual(str(WindowsError(1001, "message")),
+ "[Error 1001] message")
+ self.failUnlessEqual(WindowsError(1001, "message").errno, 22)
+ self.failUnlessEqual(WindowsError(1001, "message").winerror, 1001)
+
def testAttributes(self):
# test that exception attributes are happy