summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2009-09-18 20:08:39 (GMT)
committerThomas Heller <theller@ctypes.org>2009-09-18 20:08:39 (GMT)
commit69b639f9464d4f9d4b9303d218a2f8bfc8269591 (patch)
tree631bac786c00fe2a0c1ffa554957e11f01fd8ea7 /Modules
parentd7cb1b9119beab9a4ffb627bd65cf9e287d32b66 (diff)
downloadcpython-69b639f9464d4f9d4b9303d218a2f8bfc8269591.zip
cpython-69b639f9464d4f9d4b9303d218a2f8bfc8269591.tar.gz
cpython-69b639f9464d4f9d4b9303d218a2f8bfc8269591.tar.bz2
Merged revisions 74921 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74921 | thomas.heller | 2009-09-18 22:05:44 +0200 (Fr, 18 Sep 2009) | 3 lines Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...) does now always result in NULL. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c7
-rw-r--r--Modules/_ctypes/callproc.c1
2 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 41264d3..40cf480 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -936,8 +936,11 @@ PyCPointerType_from_param(PyObject *type, PyObject *value)
{
StgDictObject *typedict;
- if (value == Py_None)
- return PyLong_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 */
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index cbc5cf8..f5eaa0d 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -547,6 +547,7 @@ PyTypeObject PyCArg_Type = {
* 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'.