| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| .. function:: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) | ||
|
|
||
| The returned function prototype creates functions that use the standard C | ||
| Returns a function prototype which creates functions that use the standard C |
There was a problem hiding this comment.
Please don't make changes irrelevant to bpo-4260.
Sorry, something went wrong.
| .. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) | ||
|
|
||
| Windows only: The returned function prototype creates functions that use the | ||
| Windows only: Returns a function prototype which creates functions that use the |
There was a problem hiding this comment.
Please don't make changes irrelevant to bpo-4260.
Sorry, something went wrong.
| .. function:: PYFUNCTYPE(restype, *argtypes) | ||
|
|
||
| The returned function prototype creates functions that use the Python calling | ||
| Returns a function prototype which creates functions that use the Python calling |
There was a problem hiding this comment.
Please don't make changes irrelevant to bpo-4260.
Sorry, something went wrong.
| Returns a function prototype which creates functions that use the Python calling | ||
| convention. The function will *not* release the GIL during the call. | ||
|
|
||
| These factory functions can be used as decorator factories, and as such, be applied |
There was a problem hiding this comment.
I think we can move this information to the first paragraph of the "Function prototypes" section to make it more discoverable.
Also, we can add a link to the examples from that paragraph.
Sorry, something went wrong.
| write:: | ||
|
|
||
| >>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int)) | ||
| ... def py_cmp_func(*args): |
There was a problem hiding this comment.
Why didn't you reuse the py_cmp_func function in line 1008? IMO, the following snippet should work:
@CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
def py_cmp_func(a, b):
print("py_cmp_func", a[0], b[0])
return a[0] - b[0]There is even a test for that same function:
cpython/Lib/ctypes/test/test_callbacks.py
Lines 186 to 188 in b91a3a0
Sorry, something went wrong.
There was a problem hiding this comment.
I followed the proposal from David W. Lambert in the issue, but you are right, I tested the decorator with the function from line 1008 and works as well.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again 🐍🐍🐍 |
Sorry, something went wrong.
|
Thanks for making the requested changes! @berkerpeksag: please review the changes made to this pull request. |
Sorry, something went wrong.
| type and the argument types of the function, and can be used as decorator | ||
| factories, and as such, be applied to functions through the ``@wrapper`` syntax. | ||
| See :ref:`ctypes-callback-functions` for examples. | ||
|
|
There was a problem hiding this comment.
Style nit: We can drop this extra newline.
Sorry, something went wrong.
|
This looks pretty good to me, thank you! I will wait for a day or two to let others comment on the PR. Please ping me again if I don't merge this by Friday. |
Sorry, something went wrong.
|
Thanks @andresdelfino for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
Sorry, something went wrong.
|
GH-8272 is a backport of this pull request to the 3.7 branch. |
Sorry, something went wrong.
(cherry picked from commit 379e9d6) Co-authored-by: Andrés Delfino <adelfino@gmail.com>
|
GH-8273 is a backport of this pull request to the 3.6 branch. |
Sorry, something went wrong.
(cherry picked from commit 379e9d6) Co-authored-by: Andrés Delfino <adelfino@gmail.com>
* master: (2633 commits) bpo-34087: Fix buffer overflow in int(s) and similar functions (pythonGH-8274) bpo-34108: Fix double carriage return in 2to3 on Windows (python#8271) bpo-4260: Document that ctypes.xFUNCTYPE are decorators (pythonGH-7924) bpo-33723: Fix test_time.test_thread_time() (pythonGH-8267) bpo-33967: Remove use of deprecated assertRaisesRegexp() (pythonGH-8261) bpo-34080: Fix a memory leak in the compiler. (pythonGH-8222) Enable GUI testing on Travis Linux builds via Xvfb (pythonGH-7887) bpo-23927: Make getargs.c skipitem() skipping 'w*'. (pythonGH-8192) bpo-33648: Remove PY_WARN_ON_C_LOCALE (pythonGH-7114) bpo-34092, test_logging: increase SMTPHandlerTest timeout (pythonGH-8245) Simplify __all__ in multiprocessing (pythonGH-6856) bpo-34083: Update dict order in Functional HOWTO (pythonGH-8230) Doc: Point to Simple statements section instead of PEP (pythonGH-8238) bpo-29442: Replace optparse with argparse in setup.py (pythonGH-139) bpo-33597: Add What's New for PyGC_Head (pythonGH-8236) Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (pythonGH-8038) Fix documentation for input and output tutorial (pythonGH-8231) bpo-34009: Expand on platform support changes (pythonGH-8022) Factor-out two substantially identical code blocks. (pythonGH-8219) bpo-34031: fix incorrect usage of self.fail in two tests (pythonGH-8091) ...
* master: (1159 commits) bpo-34087: Fix buffer overflow in int(s) and similar functions (pythonGH-8274) bpo-34108: Fix double carriage return in 2to3 on Windows (python#8271) bpo-4260: Document that ctypes.xFUNCTYPE are decorators (pythonGH-7924) bpo-33723: Fix test_time.test_thread_time() (pythonGH-8267) bpo-33967: Remove use of deprecated assertRaisesRegexp() (pythonGH-8261) bpo-34080: Fix a memory leak in the compiler. (pythonGH-8222) Enable GUI testing on Travis Linux builds via Xvfb (pythonGH-7887) bpo-23927: Make getargs.c skipitem() skipping 'w*'. (pythonGH-8192) bpo-33648: Remove PY_WARN_ON_C_LOCALE (pythonGH-7114) bpo-34092, test_logging: increase SMTPHandlerTest timeout (pythonGH-8245) Simplify __all__ in multiprocessing (pythonGH-6856) bpo-34083: Update dict order in Functional HOWTO (pythonGH-8230) Doc: Point to Simple statements section instead of PEP (pythonGH-8238) bpo-29442: Replace optparse with argparse in setup.py (pythonGH-139) bpo-33597: Add What's New for PyGC_Head (pythonGH-8236) Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (pythonGH-8038) Fix documentation for input and output tutorial (pythonGH-8231) bpo-34009: Expand on platform support changes (pythonGH-8022) Factor-out two substantially identical code blocks. (pythonGH-8219) bpo-34031: fix incorrect usage of self.fail in two tests (pythonGH-8091) ...
…ssue-33014 * 'master' of github.com:CuriousLearner/cpython: (722 commits) bpo-34087: Fix buffer overflow in int(s) and similar functions (pythonGH-8274) bpo-34108: Fix double carriage return in 2to3 on Windows (python#8271) bpo-4260: Document that ctypes.xFUNCTYPE are decorators (pythonGH-7924) bpo-33723: Fix test_time.test_thread_time() (pythonGH-8267) bpo-33967: Remove use of deprecated assertRaisesRegexp() (pythonGH-8261) bpo-34080: Fix a memory leak in the compiler. (pythonGH-8222) Enable GUI testing on Travis Linux builds via Xvfb (pythonGH-7887) bpo-23927: Make getargs.c skipitem() skipping 'w*'. (pythonGH-8192) bpo-33648: Remove PY_WARN_ON_C_LOCALE (pythonGH-7114) bpo-34092, test_logging: increase SMTPHandlerTest timeout (pythonGH-8245) Simplify __all__ in multiprocessing (pythonGH-6856) bpo-34083: Update dict order in Functional HOWTO (pythonGH-8230) Doc: Point to Simple statements section instead of PEP (pythonGH-8238) bpo-29442: Replace optparse with argparse in setup.py (pythonGH-139) bpo-33597: Add What's New for PyGC_Head (pythonGH-8236) Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (pythonGH-8038) Fix documentation for input and output tutorial (pythonGH-8231) bpo-34009: Expand on platform support changes (pythonGH-8022) Factor-out two substantially identical code blocks. (pythonGH-8219) bpo-34031: fix incorrect usage of self.fail in two tests (pythonGH-8091) ...
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue4260