Skip to content

Commit 625519f

Browse files
miss-islingtonarrmansaZeroIntensity
authored
[3.15] gh-114150: Clarify that ctypes.PYFUNCTYPE can release the GIL during the call (GH-114151) (GH-159734)
(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 aa119b2 commit 625519f

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

20082008
The returned function prototype creates functions that use the Python calling
2009-
convention. The function will *not* release the GIL during the call.
2009+
convention. Unlike :func:`CFUNCTYPE` and :func:`WINFUNCTYPE`, ctypes does
2010+
*not* release the GIL before calling the foreign function, so the function
2011+
may safely use the Python C API. Note that this does not prevent the GIL
2012+
from being released *during* the call.
2013+
20102014

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

0 commit comments

Comments
 (0)