@@ -1378,24 +1378,22 @@ it.
1378
1378
The *mode * parameter can be used to specify how the library is loaded. For
1379
1379
details, consult the ``dlopen(3) `` manpage, on Windows, *mode * is ignored.
1380
1380
1381
- The *use_errno * parameter, when set to True, enables a ctypes
1382
- mechanism that allows to access the system `errno ` error number in a
1383
- safe way. `ctypes ` maintains a thread-local copy of the systems
1384
- `errno ` variable; if you call foreign functions created with
1385
- `use_errno=True ` then the `errno ` value before the function call is
1386
- swapped with the ctypes private copy, the same happens immediately
1387
- after the function call.
1388
-
1389
- The function `ctypes.get_errno() ` returns the value of the ctypes
1390
- private copy, and the function `ctypes.set_errno(value) ` changes the
1391
- ctypes private copy to `value ` and returns the former value.
1392
-
1393
- The *use_last_error * parameter, when set to True, enables the same
1394
- mechanism for the Windows error code which is managed by the
1395
- :func: `GetLastError ` and :func: `SetLastError ` Windows API functions;
1396
- `ctypes.get_last_error() ` and `ctypes.set_last_error(value) ` are used
1397
- to request and change the ctypes private copy of the windows error
1398
- code.
1381
+ The *use_errno * parameter, when set to True, enables a ctypes mechanism that
1382
+ allows to access the system :data: `errno ` error number in a safe way.
1383
+ :mod: `ctypes ` maintains a thread-local copy of the systems :data: `errno `
1384
+ variable; if you call foreign functions created with ``use_errno=True `` then the
1385
+ :data: `errno ` value before the function call is swapped with the ctypes private
1386
+ copy, the same happens immediately after the function call.
1387
+
1388
+ The function :func: `ctypes.get_errno ` returns the value of the ctypes private
1389
+ copy, and the function :func: `ctypes.set_errno ` changes the ctypes private copy
1390
+ to a new value and returns the former value.
1391
+
1392
+ The *use_last_error * parameter, when set to True, enables the same mechanism for
1393
+ the Windows error code which is managed by the :func: `GetLastError ` and
1394
+ :func: `SetLastError ` Windows API functions; :func: `ctypes.get_last_error ` and
1395
+ :func: `ctypes.set_last_error ` are used to request and change the ctypes private
1396
+ copy of the windows error code.
1399
1397
1400
1398
.. versionadded :: 2.6
1401
1399
The ``use_last_error `` and ``use_errno `` optional parameters
@@ -1602,22 +1600,23 @@ type and the argument types of the function.
1602
1600
.. function :: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
1603
1601
1604
1602
The returned function prototype creates functions that use the standard C
1605
- calling convention. The function will release the GIL during the call.
1606
- If `use_errno ` is set to True, the ctypes private copy of the system `errno `
1607
- variable is exchanged with the real `errno ` value bafore and after the call;
1608
- `use_last_error ` does the same for the Windows error code.
1603
+ calling convention. The function will release the GIL during the call. If
1604
+ *use_errno * is set to True, the ctypes private copy of the system
1605
+ :data: `errno ` variable is exchanged with the real :data: `errno ` value bafore
1606
+ and after the call; *use_last_error * does the same for the Windows error
1607
+ code.
1609
1608
1610
1609
.. versionchanged :: 2.6
1611
- The optional `use_errno ` and `use_last_error ` parameters were
1612
- added.
1610
+ The optional *use_errno * and *use_last_error * parameters were added.
1613
1611
1614
1612
1615
1613
.. function :: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
1616
1614
1617
1615
Windows only: The returned function prototype creates functions that use the
1618
- ``stdcall `` calling convention, except on Windows CE where :func: `WINFUNCTYPE `
1619
- is the same as :func: `CFUNCTYPE `. The function will release the GIL during the
1620
- call. `use_errno ` and `use_last_error ` have the same meaning as above.
1616
+ ``stdcall `` calling convention, except on Windows CE where
1617
+ :func: `WINFUNCTYPE ` is the same as :func: `CFUNCTYPE `. The function will
1618
+ release the GIL during the call. *use_errno * and *use_last_error * have the
1619
+ same meaning as above.
1621
1620
1622
1621
1623
1622
.. function :: PYFUNCTYPE(restype, *argtypes)
@@ -1864,10 +1863,10 @@ Utility functions
1864
1863
.. function :: find_library(name)
1865
1864
:module: ctypes.util
1866
1865
1867
- Try to find a library and return a pathname. ` name ` is the library name without
1868
- any prefix like `lib `, suffix like ``.so ``, ``.dylib `` or version number (this
1869
- is the form used for the posix linker option :option: `-l `). If no library can
1870
- be found, returns ``None ``.
1866
+ Try to find a library and return a pathname. * name * is the library name
1867
+ without any prefix like `` lib` `` , suffix like ``.so ``, ``.dylib `` or version
1868
+ number (this is the form used for the posix linker option :option: `-l `). If
1869
+ no library can be found, returns ``None ``.
1871
1870
1872
1871
The exact functionality is system dependent.
1873
1872
@@ -1905,14 +1904,14 @@ Utility functions
1905
1904
.. function :: get_errno()
1906
1905
1907
1906
Returns the current value of the ctypes-private copy of the system
1908
- `errno ` variable in the calling thread.
1907
+ :data: `errno ` variable in the calling thread.
1909
1908
1910
1909
.. versionadded :: 2.6
1911
1910
1912
1911
.. function :: get_last_error()
1913
1912
1914
1913
Windows only: returns the current value of the ctypes-private copy of the system
1915
- `LastError ` variable in the calling thread.
1914
+ :data: `LastError ` variable in the calling thread.
1916
1915
1917
1916
.. versionadded :: 2.6
1918
1917
@@ -1969,17 +1968,16 @@ Utility functions
1969
1968
1970
1969
.. function :: set_errno(value)
1971
1970
1972
- Set the current value of the ctypes-private copy of the system
1973
- `errno ` variable in the calling thread to `value ` and return the
1974
- previous value.
1971
+ Set the current value of the ctypes-private copy of the system :data: `errno `
1972
+ variable in the calling thread to *value * and return the previous value.
1975
1973
1976
1974
.. versionadded :: 2.6
1977
1975
1978
1976
.. function :: set_last_error(value)
1979
1977
1980
- Windows only: set the current value of the ctypes-private copy of
1981
- the system `LastError ` variable in the calling thread to ` value `
1982
- and return the previous value.
1978
+ Windows only: set the current value of the ctypes-private copy of the system
1979
+ :data: `LastError ` variable in the calling thread to * value * and return the
1980
+ previous value.
1983
1981
1984
1982
.. versionadded :: 2.6
1985
1983
0 commit comments