Index: Lib/ctypes/test/test_parameters.py =================================================================== --- Lib/ctypes/test/test_parameters.py (revision 67679) +++ Lib/ctypes/test/test_parameters.py (working copy) @@ -97,7 +97,7 @@ self.failUnlessEqual(x.contents.value, 42) self.failUnlessEqual(LPINT(c_int(42)).contents.value, 42) - self.failUnlessEqual(LPINT.from_param(None), 0) + self.failUnlessEqual(LPINT.from_param(None), None) if c_int != c_long: self.assertRaises(TypeError, LPINT.from_param, pointer(c_long(42))) Index: Modules/_ctypes/callproc.c =================================================================== --- Modules/_ctypes/callproc.c (revision 67679) +++ Modules/_ctypes/callproc.c (working copy) @@ -546,6 +546,7 @@ * 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'. Index: Modules/_ctypes/_ctypes.c =================================================================== --- Modules/_ctypes/_ctypes.c (revision 67679) +++ Modules/_ctypes/_ctypes.c (working copy) @@ -972,7 +972,7 @@ StgDictObject *typedict; if (value == Py_None) - return PyInt_FromLong(0); /* NULL pointer */ + return value; /* Let ConvParam convert to NULL pointer later */ typedict = PyType_stgdict(type); assert(typedict); /* Cannot be NULL for pointer types */