Merged with recent changes from trunk.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11187 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
da5ade3143
commit
8c74fa0f46
703 changed files with 21126 additions and 9266 deletions
|
|
@ -8,14 +8,16 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc)
|
|||
{
|
||||
PyObject *tmp = 0;
|
||||
int isunicode = PyUnicode_Check(obj);
|
||||
%#if PY_VERSION_HEX < 0x03000000
|
||||
if (!isunicode && PyString_Check(obj)) {
|
||||
if (cptr) {
|
||||
obj = tmp = PyUnicode_FromObject(obj);
|
||||
}
|
||||
isunicode = 1;
|
||||
}
|
||||
%#endif
|
||||
if (isunicode) {
|
||||
int len = PyUnicode_GetSize(obj);
|
||||
Py_ssize_t len = PyUnicode_GetSize(obj);
|
||||
if (cptr) {
|
||||
*cptr = %new_array(len + 1, wchar_t);
|
||||
PyUnicode_AsWideChar((PyUnicodeObject *)obj, *cptr, len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue