New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document that ctypes.xFUNCTYPE are decorators. #48510
Comments
http://docs.python.org/dev/3.0/library/ctypes.html#callback-functions ctypes.xFUNCTYPE are another opportunity to advertise decorators. @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
def py_cmp_func(*args):
(a,b,) = (t[0] for t in args)
print("py_cmp_func", a, b)
return a-b qsort(ia,len(ia),sizeof(c_int),py_cmp_func) |
As far as I know, the above code will fail randomly in release mode if For decorating a python function to give to qsort, maybe you can use |
[David Lambert]
[Kevin Watters]
Kevin is wrong - the code is perfect! Sure does calling a CFUNCTYPE instance I guess that using PYFUNCTYPE instead would possibly crash because the call to But I have no time to work on the docs, sorry. |
I suspect we'll be working on this PR a little, but a least it's a start to get this moving. |
I think we can now close this one. Thanks for the report, David, and thanks for the PR Andreas. (And thanks for creating and maintaining this awesome module for years, Thomas :)) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: