aboutsummaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2013-07-02 18:47:00 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2013-07-02 18:58:56 +0100
commitace8fcd97248dccc7bbd3b94185a49142320eda0 (patch)
tree0d806dd666f0f360162183fd30b828ef56a447ac /Lib
parentd3252bbf7fcdf326e286a2ed64d5106b61d80d19 (diff)
downloadswig-ace8fcd97248dccc7bbd3b94185a49142320eda0.tar.gz
SWIG_AsWCharPtrAndSize improper operation if cptr NULL
SF bug #1327 This doesn't have any noticeable effect with the usage of SWIG_AsWCharPtrAndSize as shipped by SWIG, but could be a problem if a user is using this function with cptr equal to zero and psize is non-zero - the length would be incorrectly set due to the call to PyUnicode_GetSize failing.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/python/pywstrings.swg4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg
index 619bdd555..864376b01 100644
--- a/Lib/python/pywstrings.swg
+++ b/Lib/python/pywstrings.swg
@@ -18,9 +18,7 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc)
int isunicode = PyUnicode_Check(obj);
%#if PY_VERSION_HEX < 0x03000000
if (!isunicode && PyString_Check(obj)) {
- if (cptr) {
- obj = tmp = PyUnicode_FromObject(obj);
- }
+ obj = tmp = PyUnicode_FromObject(obj);
isunicode = 1;
}
%#endif