Skip to content

Commit d42178a

Browse files
gh-114150: Clarify that ctypes.PYFUNCTYPE can release the GIL during the call (GH-114151)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent f0f76de commit d42178a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎Doc/library/ctypes.rst‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,11 @@ See :ref:`ctypes-callback-functions` for examples.
20522052
.. function:: PYFUNCTYPE(restype, *argtypes)
20532053

20542054
The returned function prototype creates functions that use the Python calling
2055-
convention. The function will *not* release the GIL during the call.
2055+
convention. Unlike :func:`CFUNCTYPE` and :func:`WINFUNCTYPE`, ctypes does
2056+
*not* release the GIL before calling the foreign function, so the function
2057+
may safely use the Python C API. Note that this does not prevent the GIL
2058+
from being released *during* the call.
2059+
20562060

20572061
Function prototypes created by these factory functions can be instantiated in
20582062
different ways, depending on the type and number of the parameters in the call:

0 commit comments

Comments
 (0)