Skip to content

Commit 1907e13

Browse files
miss-islingtonarrmansaZeroIntensity
authored
[3.14] gh-114150: Clarify that ctypes.PYFUNCTYPE can release the GIL during the call (GH-114151) (GH-159735)
(cherry picked from commit d42178a) Co-authored-by: arrmansa <41120982+arrmansa@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent 8e62b08 commit 1907e13

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
@@ -1968,7 +1968,11 @@ See :ref:`ctypes-callback-functions` for examples.
19681968
.. function:: PYFUNCTYPE(restype, *argtypes)
19691969

19701970
The returned function prototype creates functions that use the Python calling
1971-
convention. The function will *not* release the GIL during the call.
1971+
convention. Unlike :func:`CFUNCTYPE` and :func:`WINFUNCTYPE`, ctypes does
1972+
*not* release the GIL before calling the foreign function, so the function
1973+
may safely use the Python C API. Note that this does not prevent the GIL
1974+
from being released *during* the call.
1975+
19721976

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

0 commit comments

Comments
 (0)