summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-03-09 20:21:16 (GMT)
committerThomas Heller <theller@ctypes.org>2007-03-09 20:21:16 (GMT)
commitf7eed5e2d1667f8caec2ddbea20915566e5fbd98 (patch)
tree1f332e8cb0619b9c3dbdd923d4f9d57718df7b7e /Modules
parente7881559f23800d45c04fe7bc8e6a7031fb5e665 (diff)
downloadcpython-f7eed5e2d1667f8caec2ddbea20915566e5fbd98.zip
cpython-f7eed5e2d1667f8caec2ddbea20915566e5fbd98.tar.gz
cpython-f7eed5e2d1667f8caec2ddbea20915566e5fbd98.tar.bz2
Merged revisions 54244 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Lib/ctypes ........ r54244 | thomas.heller | 2007-03-09 20:21:28 +0100 (Fr, 09 Mär 2007) | 3 lines Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0) returned string up to the first NUL character. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 89c5aae..69d3157 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4531,9 +4531,9 @@ create_comerror(void)
#endif
static PyObject *
-string_at(const char *ptr, Py_ssize_t size)
+string_at(const char *ptr, int size)
{
- if (size == 0)
+ if (size == -1)
return PyString_FromString(ptr);
return PyString_FromStringAndSize(ptr, size);
}
@@ -4618,7 +4618,7 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
static PyObject *
wstring_at(const wchar_t *ptr, int size)
{
- if (size == 0)
+ if (size == -1)
size = wcslen(ptr);
return PyUnicode_FromWideChar(ptr, size);
}