mirror of https://github.com/python/cpython
gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226)
This commit is contained in:
parent
aec1dac4ef
commit
438b7c3071
|
@ -221,13 +221,14 @@ For convenience, some of these functions will always return a
|
||||||
|
|
||||||
.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)
|
.. 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`
|
*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
|
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`,
|
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
|
then it constructs a :exc:`OSError` object with the :attr:`~OSError.winerror`
|
||||||
second item is the corresponding error message (gotten from
|
attribute set to the error code, the :attr:`~OSError.strerror` attribute
|
||||||
:c:func:`!FormatMessage`), and then calls ``PyErr_SetObject(PyExc_WindowsError,
|
set to the corresponding error message (gotten from
|
||||||
|
:c:func:`!FormatMessage`), and then calls ``PyErr_SetObject(PyExc_OSError,
|
||||||
object)``. This function always returns ``NULL``.
|
object)``. This function always returns ``NULL``.
|
||||||
|
|
||||||
.. availability:: Windows.
|
.. availability:: Windows.
|
||||||
|
|
Loading…
Reference in New Issue