Feature or enhancement
Proposal:
The idea is to add a decorator that extracts type annotations and a name for a function signature, and then use that information to generate argtypes and restype for a _CFuncPtr object. For example:
@wrap_dll_function(ctypes.pythonapi)
def PyObject_GetAttrString(op: ctypes.py_object, attr: ctypes.c_char_p) -> ctypes.py_object:
...
See #104533 for prior work.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579
Linked PRs
Feature or enhancement
Proposal:
The idea is to add a decorator that extracts type annotations and a name for a function signature, and then use that information to generate
argtypesandrestypefor a_CFuncPtrobject. For example:See #104533 for prior work.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/annotation-based-sugar-for-ctypes/26579
Linked PRs
ctypesdecorator for generating function pointers using annotations #153904@ctypes.util.wrap_dll_function()with pythonapi #154030@ctypes.util.wrap_dll_function()#154122