[New-bugs-announce] [issue18017] ctypes.PyDLL documentation

Marc Brünink report at bugs.python.org
Mon May 20 02:38:39 CEST 2013

New submission from Marc Brünink:

The documentation for is not very clear regarding the usage of CDLL and PyDLL. Especially it is not obvious that you should use PyDLL whenever you call any function of the Python/C API. Since calling a Python/C API function without owning the GIL will most likely cause latent segfaults, I think it warrants a warning box in section and maybe also somewhere prominent in http://docs.python.org/dev/c-api/intro.html.

For section I would put a box next the decription of CDLL saying something like: "The Python GIL is released before a function call. It is not safe to call any Pyhon/C API function within the loaded library without acquiring the GIL first. Thus, if the loaded library calls functions of the Python/C API, for example in case it creates and returns a new Python object, and does not manually acquire and release the GIL, use PyDLL instead."

assignee: docs at python
components: Documentation
messages: 189629
nosy: Marc.Brünink, docs at python
priority: normal
severity: normal
status: open
title: ctypes.PyDLL documentation
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list