Remove the special casing of Py_None when converting the return value
of the Python part of a callback function to C. If it cannot be
converted, call PyErr_WriteUnraisable with the exception we got.
Before, arbitrary data has been passed to the calling C code in this
case.
(I'm not really sure the NEWS entry is understandable, but I cannot
find better words)
diff --git a/Misc/NEWS b/Misc/NEWS
index ab40d3d..dc99ff7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -64,6 +64,11 @@
Library
-------
+- If a the Python part of a ctypes callback function returns None,
+ and this cannot be converted to the required C type, an exception is
+ printed with PyErr_WriteUnraisable. Before this change, the C
+ callback did return arbitrary values to the calling code.
+
- The __repr__ method of a NULL ctypes.py_object() no longer raises
an exception.