This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thijsmiedema94
Recipients thijsmiedema94
Date 2021-02-12.14:44:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613141097.76.0.252191412274.issue43208@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-02-12 14:44:57thijsmiedema94setrecipients: + thijsmiedema94
2021-02-12 14:44:57thijsmiedema94setmessageid: <1613141097.76.0.252191412274.issue43208@roundup.psfhosted.org>
2021-02-12 14:44:57thijsmiedema94linkissue43208 messages
2021-02-12 14:44:57thijsmiedema94create