Message386867
When setting the restype of a ctypes._FuncPtr you can use None to indicate a void function. However, I use inspect.signature to dynamically bind python functions to a DLL, and that doesn't return None but NoneType if the type hint return type is None starting at python 3.10.
This change caused me to set the restype to NoneType, which makes ctypes cause a cryptic "TypeError: NoneType takes no arguments" upon returning from a successfully executed C function.
The included example demonstrates the differing results from inspect, a working example, a failing example and an example that works in 3.9 but fails in 3.10.
Proposed solution: Treat NoneType as None for ctypes._FuncPtr.restype |
|
Date |
User |
Action |
Args |
2021-02-12 14:44:57 | thijsmiedema94 | set | recipients:
+ thijsmiedema94 |
2021-02-12 14:44:57 | thijsmiedema94 | set | messageid: <1613141097.76.0.252191412274.issue43208@roundup.psfhosted.org> |
2021-02-12 14:44:57 | thijsmiedema94 | link | issue43208 messages |
2021-02-12 14:44:57 | thijsmiedema94 | create | |
|