@@ -1413,13 +1413,15 @@ way is to instantiate one of the following classes:
1413
1413
1414
1414
.. class :: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
1415
1415
1416
- Windows only: Instances of this class represent loaded shared libraries,
1416
+ Instances of this class represent loaded shared libraries,
1417
1417
functions in these libraries use the ``stdcall `` calling convention, and are
1418
1418
assumed to return the windows specific :class: `HRESULT ` code. :class: `HRESULT `
1419
1419
values contain information specifying whether the function call failed or
1420
1420
succeeded, together with additional error code. If the return value signals a
1421
1421
failure, an :class: `OSError ` is automatically raised.
1422
1422
1423
+ .. availability :: Windows
1424
+
1423
1425
.. versionchanged :: 3.3
1424
1426
:exc: `WindowsError ` used to be raised,
1425
1427
which is now an alias of :exc: `OSError `.
@@ -1431,14 +1433,17 @@ way is to instantiate one of the following classes:
1431
1433
1432
1434
.. class :: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
1433
1435
1434
- Windows only: Instances of this class represent loaded shared libraries,
1436
+ Instances of this class represent loaded shared libraries,
1435
1437
functions in these libraries use the ``stdcall `` calling convention, and are
1436
1438
assumed to return :c:expr: `int ` by default.
1437
1439
1440
+ .. availability :: Windows
1441
+
1438
1442
.. versionchanged :: 3.12
1439
1443
1440
1444
The *name * parameter can now be a :term: `path-like object `.
1441
1445
1446
+
1442
1447
The Python :term: `global interpreter lock ` is released before calling any
1443
1448
function exported by these libraries, and reacquired afterwards.
1444
1449
@@ -1574,13 +1579,17 @@ These prefabricated library loaders are available:
1574
1579
.. data :: windll
1575
1580
:noindex:
1576
1581
1577
- Windows only: Creates :class: `WinDLL ` instances.
1582
+ Creates :class: `WinDLL ` instances.
1583
+
1584
+ .. availability :: Windows
1578
1585
1579
1586
1580
1587
.. data :: oledll
1581
1588
:noindex:
1582
1589
1583
- Windows only: Creates :class: `OleDLL ` instances.
1590
+ Creates :class: `OleDLL ` instances.
1591
+
1592
+ .. availability :: Windows
1584
1593
1585
1594
1586
1595
.. data :: pydll
@@ -1746,11 +1755,13 @@ See :ref:`ctypes-callback-functions` for examples.
1746
1755
1747
1756
.. function :: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
1748
1757
1749
- Windows only: The returned function prototype creates functions that use the
1758
+ The returned function prototype creates functions that use the
1750
1759
``stdcall `` calling convention. The function will
1751
1760
release the GIL during the call. *use_errno * and *use_last_error * have the
1752
1761
same meaning as above.
1753
1762
1763
+ .. availability :: Windows
1764
+
1754
1765
1755
1766
.. function :: PYFUNCTYPE(restype, *argtypes)
1756
1767
@@ -1981,17 +1992,21 @@ Utility functions
1981
1992
1982
1993
.. function :: DllCanUnloadNow()
1983
1994
1984
- Windows only: This function is a hook which allows implementing in-process
1995
+ This function is a hook which allows implementing in-process
1985
1996
COM servers with ctypes. It is called from the DllCanUnloadNow function that
1986
1997
the _ctypes extension dll exports.
1987
1998
1999
+ .. availability :: Windows
2000
+
1988
2001
1989
2002
.. function :: DllGetClassObject()
1990
2003
1991
- Windows only: This function is a hook which allows implementing in-process
2004
+ This function is a hook which allows implementing in-process
1992
2005
COM servers with ctypes. It is called from the DllGetClassObject function
1993
2006
that the ``_ctypes `` extension dll exports.
1994
2007
2008
+ .. availability :: Windows
2009
+
1995
2010
1996
2011
.. function :: find_library(name)
1997
2012
:module: ctypes.util
@@ -2007,28 +2022,35 @@ Utility functions
2007
2022
.. function :: find_msvcrt()
2008
2023
:module: ctypes.util
2009
2024
2010
- Windows only: return the filename of the VC runtime library used by Python,
2025
+ Returns the filename of the VC runtime library used by Python,
2011
2026
and by the extension modules. If the name of the library cannot be
2012
2027
determined, ``None `` is returned.
2013
2028
2014
2029
If you need to free memory, for example, allocated by an extension module
2015
2030
with a call to the ``free(void *) ``, it is important that you use the
2016
2031
function in the same library that allocated the memory.
2017
2032
2033
+ .. availability :: Windows
2034
+
2018
2035
2019
2036
.. function :: FormatError([code])
2020
2037
2021
- Windows only: Returns a textual description of the error code *code *. If no
2038
+ Returns a textual description of the error code *code *. If no
2022
2039
error code is specified, the last error code is used by calling the Windows
2023
2040
api function GetLastError.
2024
2041
2042
+ .. availability :: Windows
2043
+
2025
2044
2026
2045
.. function :: GetLastError()
2027
2046
2028
- Windows only: Returns the last error code set by Windows in the calling thread.
2047
+ Returns the last error code set by Windows in the calling thread.
2029
2048
This function calls the Windows ``GetLastError() `` function directly,
2030
2049
it does not return the ctypes-private copy of the error code.
2031
2050
2051
+ .. availability :: Windows
2052
+
2053
+
2032
2054
.. function :: get_errno()
2033
2055
2034
2056
Returns the current value of the ctypes-private copy of the system
@@ -2038,11 +2060,14 @@ Utility functions
2038
2060
2039
2061
.. function :: get_last_error()
2040
2062
2041
- Windows only: returns the current value of the ctypes-private copy of the system
2063
+ Returns the current value of the ctypes-private copy of the system
2042
2064
:data: `!LastError ` variable in the calling thread.
2043
2065
2066
+ .. availability :: Windows
2067
+
2044
2068
.. audit-event :: ctypes.get_last_error "" ctypes.get_last_error
2045
2069
2070
+
2046
2071
.. function :: memmove(dst, src, count)
2047
2072
2048
2073
Same as the standard C memmove library function: copies *count * bytes from
@@ -2091,10 +2116,12 @@ Utility functions
2091
2116
2092
2117
.. function :: set_last_error(value)
2093
2118
2094
- Windows only: set the current value of the ctypes-private copy of the system
2119
+ Sets the current value of the ctypes-private copy of the system
2095
2120
:data: `!LastError ` variable in the calling thread to *value * and return the
2096
2121
previous value.
2097
2122
2123
+ .. availability :: Windows
2124
+
2098
2125
.. audit-event :: ctypes.set_last_error error ctypes.set_last_error
2099
2126
2100
2127
@@ -2115,12 +2142,14 @@ Utility functions
2115
2142
2116
2143
.. function :: WinError(code=None, descr=None)
2117
2144
2118
- Windows only: this function is probably the worst-named thing in ctypes. It
2145
+ This function is probably the worst-named thing in ctypes. It
2119
2146
creates an instance of :exc: `OSError `. If *code * is not specified,
2120
2147
``GetLastError `` is called to determine the error code. If *descr * is not
2121
2148
specified, :func: `FormatError ` is called to get a textual description of the
2122
2149
error.
2123
2150
2151
+ .. availability :: Windows
2152
+
2124
2153
.. versionchanged :: 3.3
2125
2154
An instance of :exc: `WindowsError ` used to be created, which is now an
2126
2155
alias of :exc: `OSError `.
@@ -2484,9 +2513,11 @@ These are the fundamental ctypes data types:
2484
2513
2485
2514
.. class :: HRESULT
2486
2515
2487
- Windows only: Represents a :c:type: `!HRESULT ` value, which contains success or
2516
+ Represents a :c:type: `!HRESULT ` value, which contains success or
2488
2517
error information for a function or method call.
2489
2518
2519
+ .. availability :: Windows
2520
+
2490
2521
2491
2522
.. class :: py_object
2492
2523
@@ -2755,7 +2786,7 @@ Exceptions
2755
2786
2756
2787
.. exception :: COMError(hresult, text, details)
2757
2788
2758
- Windows only: This exception is raised when a COM method call failed.
2789
+ This exception is raised when a COM method call failed.
2759
2790
2760
2791
.. attribute :: hresult
2761
2792
@@ -2775,4 +2806,6 @@ Exceptions
2775
2806
identifier. *progid * is the ``ProgID `` of the interface that defined the
2776
2807
error.
2777
2808
2809
+ .. availability :: Windows
2810
+
2778
2811
.. versionadded :: next
0 commit comments