cpython: e5df201c0846 (original) (raw)

--- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -232,44 +232,71 @@ The following exceptions are the excepti classes to override the method. -.. exception:: OSError +.. exception:: OSError([arg])

.. index:: module: errno This exception is raised when a system function returns a system-related error, including I/O failures such as "file not found" or "disk full"

+

+

+

+

+

.. versionchanged:: 3.3 :exc:EnvironmentError, :exc:IOError, :exc:WindowsError, :exc:VMSError, :exc:socket.error, :exc:select.error and

.. versionchanged:: 3.4 The :attr:filename attribute is now the original file name passed to the function, instead of the name encoded to or decoded from the

.. exception:: OverflowError

--- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -233,6 +233,7 @@ class ExceptionTests(unittest.TestCase): self.assertEqual(w.winerror, 3) self.assertEqual(w.strerror, 'foo') self.assertEqual(w.filename, 'bar')

@@ -240,6 +241,7 @@ class ExceptionTests(unittest.TestCase): self.assertEqual(w.winerror, 1001) self.assertEqual(w.strerror, 'foo') self.assertEqual(w.filename, None)

@@ -247,6 +249,7 @@ class ExceptionTests(unittest.TestCase): self.assertEqual(w.winerror, None) self.assertEqual(w.strerror, 'foo') self.assertEqual(w.filename, None)

@unittest.skipUnless(sys.platform == 'win32', 'test specific to Windows') @@ -271,13 +274,15 @@ class ExceptionTests(unittest.TestCase): (SystemExit, ('foo',), {'args' : ('foo',), 'code' : 'foo'}), (OSError, ('foo',),

@@ -287,7 +292,8 @@ class ExceptionTests(unittest.TestCase): 'filename' : 'filenameStr'}), (OSError, (1, 'strErrorStr', 'filenameStr'), {'args' : (1, 'strErrorStr'), 'errno' : 1,

@@ -343,7 +349,8 @@ class ExceptionTests(unittest.TestCase): (WindowsError, (1, 'strErrorStr', 'filenameStr'), {'args' : (1, 'strErrorStr'), 'strerror' : 'strErrorStr', 'winerror' : None,