does now always result in NULL.
self.assertEqual(x.contents.value, 42)
self.assertEqual(LPINT(c_int(42)).contents.value, 42)
- self.assertEqual(LPINT.from_param(None), 0)
+ self.assertEqual(LPINT.from_param(None), None)
if c_int != c_long:
self.assertRaises(TypeError, LPINT.from_param, pointer(c_long(42)))
Library
-------
-- Issue #5042: Structure sub-subclass does now initialize correctly
- with base class positional arguments.
+- Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...)
+ does now always result in NULL.
+
+- Issue #5042: ctypes Structure sub-subclass does now initialize
+ correctly with base class positional arguments.
- Issue #6938: Fix a TypeError in string formatting of a multiprocessing
debug message.
{
StgDictObject *typedict;
- if (value == Py_None)
- return PyInt_FromLong(0); /* NULL pointer */
+ if (value == Py_None) {
+ /* ConvParam will convert to a NULL pointer later */
+ Py_INCREF(value);
+ return value;
+ }
typedict = PyType_stgdict(type);
assert(typedict); /* Cannot be NULL for pointer types */
* C function call.
*
* 1. Python integers are converted to C int and passed by value.
+ * Py_None is converted to a C NULL pointer.
*
* 2. 3-tuples are expected to have a format character in the first
* item, which must be 'i', 'f', 'd', 'q', or 'P'.