summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes/_ctypes.c
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2009-09-18 20:09:57 (GMT)
committerThomas Heller <theller@ctypes.org>2009-09-18 20:09:57 (GMT)
commit49ac2ac740d4bc4a3b31986535638cd8f86ecec1 (patch)
treef789c276f10701ac253859c1a05e602a3662937c /Modules/_ctypes/_ctypes.c
parent35888e2b3c0c36e6a6286416a60324da14b5560e (diff)
downloadcpython-49ac2ac740d4bc4a3b31986535638cd8f86ecec1.zip
cpython-49ac2ac740d4bc4a3b31986535638cd8f86ecec1.tar.gz
cpython-49ac2ac740d4bc4a3b31986535638cd8f86ecec1.tar.bz2
Merged revisions 74922 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74922 | thomas.heller | 2009-09-18 22:08:39 +0200 (Fr, 18 Sep 2009) | 10 lines 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/_ctypes/_ctypes.c')
-rw-r--r--Modules/_ctypes/_ctypes.c7
1 files changed, 5 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 */