https://github.com/python/cpython/commit/ac48fdeb0d26c50754eedddfa865b27542dfaeb7
commit: ac48fdeb0d26c50754eedddfa865b27542dfaeb7
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-04-17T10:28:55Z
summary:

[3.12] gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226) 
(GH-117973)

(cherry picked from commit 438b7c3071eebaccd1ba215f15a239345b22f813)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
M Doc/c-api/exceptions.rst

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index dd49d2d219ae4c..7ddecb24734cc0 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -208,13 +208,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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to