summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-04-17 10:03:26 (GMT)
committerGitHub <noreply@github.com>2024-04-17 10:03:26 (GMT)
commit438b7c3071eebaccd1ba215f15a239345b22f813 (patch)
tree85417a983bc0ae5dfc5626b7dabfb4a4d117a35e /Doc/c-api
parentaec1dac4efe36a7db51f08385ddcce978814dbe3 (diff)
downloadcpython-438b7c3071eebaccd1ba215f15a239345b22f813.zip
cpython-438b7c3071eebaccd1ba215f15a239345b22f813.tar.gz
cpython-438b7c3071eebaccd1ba215f15a239345b22f813.tar.bz2
gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226)
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/exceptions.rst9
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index ba13fd1..d5c25a6 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -221,13 +221,14 @@ For convenience, some of these functions will always return a
.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
- This is a convenience function to raise :exc:`WindowsError`. If called with
+ This is a convenience function to raise :exc:`OSError`. If called with
*ierr* of ``0``, the error code returned by a call to :c:func:`!GetLastError`
is used instead. It calls the Win32 function :c:func:`!FormatMessage` to retrieve
the Windows description of error code given by *ierr* or :c:func:`!GetLastError`,
- then it constructs a tuple object whose first item is the *ierr* value and whose
- second item is the corresponding error message (gotten from
- :c:func:`!FormatMessage`), and then calls ``PyErr_SetObject(PyExc_WindowsError,
+ then it constructs a :exc:`OSError` object with the :attr:`~OSError.winerror`
+ attribute set to the error code, the :attr:`~OSError.strerror` attribute
+ set to the corresponding error message (gotten from
+ :c:func:`!FormatMessage`), and then calls ``PyErr_SetObject(PyExc_OSError,
object)``. This function always returns ``NULL``.
.. availability:: Windows.