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 16.17.2.2 and maybe also somewhere prominent in 
http://docs.python.org/dev/c-api/intro.html.

For section 16.17.2.2 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@python
components: Documentation
messages: 189629
nosy: Marc.Brünink, docs@python
priority: normal
severity: normal
status: open
title: ctypes.PyDLL documentation
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18017>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to