mirror of
https://github.com/python/cpython.git
synced 2024-11-23 01:45:25 +08:00
gh-127082: Replace "Windows only" with the availability: Windows
in ctypes
doc (#127099)
This commit is contained in:
parent
89125e9f9f
commit
3c770e3f09
@ -1413,13 +1413,15 @@ way is to instantiate one of the following classes:
|
|||||||
|
|
||||||
.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
|
.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
|
||||||
|
|
||||||
Windows only: Instances of this class represent loaded shared libraries,
|
Instances of this class represent loaded shared libraries,
|
||||||
functions in these libraries use the ``stdcall`` calling convention, and are
|
functions in these libraries use the ``stdcall`` calling convention, and are
|
||||||
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
|
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
|
||||||
values contain information specifying whether the function call failed or
|
values contain information specifying whether the function call failed or
|
||||||
succeeded, together with additional error code. If the return value signals a
|
succeeded, together with additional error code. If the return value signals a
|
||||||
failure, an :class:`OSError` is automatically raised.
|
failure, an :class:`OSError` is automatically raised.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
:exc:`WindowsError` used to be raised,
|
:exc:`WindowsError` used to be raised,
|
||||||
which is now an alias of :exc:`OSError`.
|
which is now an alias of :exc:`OSError`.
|
||||||
@ -1431,14 +1433,17 @@ way is to instantiate one of the following classes:
|
|||||||
|
|
||||||
.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
|
.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
|
||||||
|
|
||||||
Windows only: Instances of this class represent loaded shared libraries,
|
Instances of this class represent loaded shared libraries,
|
||||||
functions in these libraries use the ``stdcall`` calling convention, and are
|
functions in these libraries use the ``stdcall`` calling convention, and are
|
||||||
assumed to return :c:expr:`int` by default.
|
assumed to return :c:expr:`int` by default.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. versionchanged:: 3.12
|
.. versionchanged:: 3.12
|
||||||
|
|
||||||
The *name* parameter can now be a :term:`path-like object`.
|
The *name* parameter can now be a :term:`path-like object`.
|
||||||
|
|
||||||
|
|
||||||
The Python :term:`global interpreter lock` is released before calling any
|
The Python :term:`global interpreter lock` is released before calling any
|
||||||
function exported by these libraries, and reacquired afterwards.
|
function exported by these libraries, and reacquired afterwards.
|
||||||
|
|
||||||
@ -1574,13 +1579,17 @@ These prefabricated library loaders are available:
|
|||||||
.. data:: windll
|
.. data:: windll
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
Windows only: Creates :class:`WinDLL` instances.
|
Creates :class:`WinDLL` instances.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. data:: oledll
|
.. data:: oledll
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
Windows only: Creates :class:`OleDLL` instances.
|
Creates :class:`OleDLL` instances.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. data:: pydll
|
.. data:: pydll
|
||||||
@ -1746,11 +1755,13 @@ See :ref:`ctypes-callback-functions` for examples.
|
|||||||
|
|
||||||
.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
|
.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
|
||||||
|
|
||||||
Windows only: The returned function prototype creates functions that use the
|
The returned function prototype creates functions that use the
|
||||||
``stdcall`` calling convention. The function will
|
``stdcall`` calling convention. The function will
|
||||||
release the GIL during the call. *use_errno* and *use_last_error* have the
|
release the GIL during the call. *use_errno* and *use_last_error* have the
|
||||||
same meaning as above.
|
same meaning as above.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: PYFUNCTYPE(restype, *argtypes)
|
.. function:: PYFUNCTYPE(restype, *argtypes)
|
||||||
|
|
||||||
@ -1981,17 +1992,21 @@ Utility functions
|
|||||||
|
|
||||||
.. function:: DllCanUnloadNow()
|
.. function:: DllCanUnloadNow()
|
||||||
|
|
||||||
Windows only: This function is a hook which allows implementing in-process
|
This function is a hook which allows implementing in-process
|
||||||
COM servers with ctypes. It is called from the DllCanUnloadNow function that
|
COM servers with ctypes. It is called from the DllCanUnloadNow function that
|
||||||
the _ctypes extension dll exports.
|
the _ctypes extension dll exports.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: DllGetClassObject()
|
.. function:: DllGetClassObject()
|
||||||
|
|
||||||
Windows only: This function is a hook which allows implementing in-process
|
This function is a hook which allows implementing in-process
|
||||||
COM servers with ctypes. It is called from the DllGetClassObject function
|
COM servers with ctypes. It is called from the DllGetClassObject function
|
||||||
that the ``_ctypes`` extension dll exports.
|
that the ``_ctypes`` extension dll exports.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: find_library(name)
|
.. function:: find_library(name)
|
||||||
:module: ctypes.util
|
:module: ctypes.util
|
||||||
@ -2007,7 +2022,7 @@ Utility functions
|
|||||||
.. function:: find_msvcrt()
|
.. function:: find_msvcrt()
|
||||||
:module: ctypes.util
|
:module: ctypes.util
|
||||||
|
|
||||||
Windows only: return the filename of the VC runtime library used by Python,
|
Returns the filename of the VC runtime library used by Python,
|
||||||
and by the extension modules. If the name of the library cannot be
|
and by the extension modules. If the name of the library cannot be
|
||||||
determined, ``None`` is returned.
|
determined, ``None`` is returned.
|
||||||
|
|
||||||
@ -2015,20 +2030,27 @@ Utility functions
|
|||||||
with a call to the ``free(void *)``, it is important that you use the
|
with a call to the ``free(void *)``, it is important that you use the
|
||||||
function in the same library that allocated the memory.
|
function in the same library that allocated the memory.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: FormatError([code])
|
.. function:: FormatError([code])
|
||||||
|
|
||||||
Windows only: Returns a textual description of the error code *code*. If no
|
Returns a textual description of the error code *code*. If no
|
||||||
error code is specified, the last error code is used by calling the Windows
|
error code is specified, the last error code is used by calling the Windows
|
||||||
api function GetLastError.
|
api function GetLastError.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: GetLastError()
|
.. function:: GetLastError()
|
||||||
|
|
||||||
Windows only: Returns the last error code set by Windows in the calling thread.
|
Returns the last error code set by Windows in the calling thread.
|
||||||
This function calls the Windows ``GetLastError()`` function directly,
|
This function calls the Windows ``GetLastError()`` function directly,
|
||||||
it does not return the ctypes-private copy of the error code.
|
it does not return the ctypes-private copy of the error code.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. function:: get_errno()
|
.. function:: get_errno()
|
||||||
|
|
||||||
Returns the current value of the ctypes-private copy of the system
|
Returns the current value of the ctypes-private copy of the system
|
||||||
@ -2038,11 +2060,14 @@ Utility functions
|
|||||||
|
|
||||||
.. function:: get_last_error()
|
.. function:: get_last_error()
|
||||||
|
|
||||||
Windows only: returns the current value of the ctypes-private copy of the system
|
Returns the current value of the ctypes-private copy of the system
|
||||||
:data:`!LastError` variable in the calling thread.
|
:data:`!LastError` variable in the calling thread.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. audit-event:: ctypes.get_last_error "" ctypes.get_last_error
|
.. audit-event:: ctypes.get_last_error "" ctypes.get_last_error
|
||||||
|
|
||||||
|
|
||||||
.. function:: memmove(dst, src, count)
|
.. function:: memmove(dst, src, count)
|
||||||
|
|
||||||
Same as the standard C memmove library function: copies *count* bytes from
|
Same as the standard C memmove library function: copies *count* bytes from
|
||||||
@ -2091,10 +2116,12 @@ Utility functions
|
|||||||
|
|
||||||
.. function:: set_last_error(value)
|
.. function:: set_last_error(value)
|
||||||
|
|
||||||
Windows only: set the current value of the ctypes-private copy of the system
|
Sets the current value of the ctypes-private copy of the system
|
||||||
:data:`!LastError` variable in the calling thread to *value* and return the
|
:data:`!LastError` variable in the calling thread to *value* and return the
|
||||||
previous value.
|
previous value.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. audit-event:: ctypes.set_last_error error ctypes.set_last_error
|
.. audit-event:: ctypes.set_last_error error ctypes.set_last_error
|
||||||
|
|
||||||
|
|
||||||
@ -2115,12 +2142,14 @@ Utility functions
|
|||||||
|
|
||||||
.. function:: WinError(code=None, descr=None)
|
.. function:: WinError(code=None, descr=None)
|
||||||
|
|
||||||
Windows only: this function is probably the worst-named thing in ctypes. It
|
This function is probably the worst-named thing in ctypes. It
|
||||||
creates an instance of :exc:`OSError`. If *code* is not specified,
|
creates an instance of :exc:`OSError`. If *code* is not specified,
|
||||||
``GetLastError`` is called to determine the error code. If *descr* is not
|
``GetLastError`` is called to determine the error code. If *descr* is not
|
||||||
specified, :func:`FormatError` is called to get a textual description of the
|
specified, :func:`FormatError` is called to get a textual description of the
|
||||||
error.
|
error.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
An instance of :exc:`WindowsError` used to be created, which is now an
|
An instance of :exc:`WindowsError` used to be created, which is now an
|
||||||
alias of :exc:`OSError`.
|
alias of :exc:`OSError`.
|
||||||
@ -2484,9 +2513,11 @@ These are the fundamental ctypes data types:
|
|||||||
|
|
||||||
.. class:: HRESULT
|
.. class:: HRESULT
|
||||||
|
|
||||||
Windows only: Represents a :c:type:`!HRESULT` value, which contains success or
|
Represents a :c:type:`!HRESULT` value, which contains success or
|
||||||
error information for a function or method call.
|
error information for a function or method call.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
|
|
||||||
.. class:: py_object
|
.. class:: py_object
|
||||||
|
|
||||||
@ -2755,7 +2786,7 @@ Exceptions
|
|||||||
|
|
||||||
.. exception:: COMError(hresult, text, details)
|
.. exception:: COMError(hresult, text, details)
|
||||||
|
|
||||||
Windows only: This exception is raised when a COM method call failed.
|
This exception is raised when a COM method call failed.
|
||||||
|
|
||||||
.. attribute:: hresult
|
.. attribute:: hresult
|
||||||
|
|
||||||
@ -2775,4 +2806,6 @@ Exceptions
|
|||||||
identifier. *progid* is the ``ProgID`` of the interface that defined the
|
identifier. *progid* is the ``ProgID`` of the interface that defined the
|
||||||
error.
|
error.
|
||||||
|
|
||||||
|
.. availability:: Windows
|
||||||
|
|
||||||
.. versionadded:: next
|
.. versionadded:: next
|
||||||
|
Loading…
Reference in New Issue
Block a user