summaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-06 10:54:11 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-10-06 17:04:20 -0300
commit2564403d447449de938cd5853b82422b3c32aedc (patch)
tree61e26c0cabd3c69399dc4ca0e0f30b0739e63c77 /libshiboken
parent6b8ff873c97a63b67a0a5bddf98373df47eac67c (diff)
downloadshiboken-2564403d447449de938cd5853b82422b3c32aedc.tar.gz
shiboken-2564403d447449de938cd5853b82422b3c32aedc.tar.xz
shiboken-2564403d447449de938cd5853b82422b3c32aedc.zip
Fix string.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkstring.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/libshiboken/sbkstring.cpp b/libshiboken/sbkstring.cpp
index c20c487e..a16fa384 100644
--- a/libshiboken/sbkstring.cpp
+++ b/libshiboken/sbkstring.cpp
@@ -73,28 +73,32 @@ const char* toCString(PyObject* str)
if (str == Py_None)
return NULL;
#if PY_MAJOR_VERSION >= 3
- return _PyUnicode_AsString(str);
+ if (PyUnicode_Check(str))
+ return _PyUnicode_AsString(str);
#else
- return PyBytes_AS_STRING(str);
+ if (PyString_Check(str))
+ return PyString_AS_STRING(str);
#endif
+ if (PyBytes_Check(str))
+ return PyBytes_AsString(str);
}
bool concat(PyObject** val1, PyObject* val2)
{
- if (PyUnicode_Check(val1) && PyUnicode_Check(val2)) {
+ if (PyUnicode_Check(*val1) && PyUnicode_Check(val2)) {
PyObject* result = PyUnicode_Concat(*val1, val2);
Py_DECREF(*val1);
*val1 = result;
return true;
}
- if (PyBytes_Check(val1) && PyBytes_Check(val2)) {
+ if (PyBytes_Check(*val1) && PyBytes_Check(val2)) {
PyBytes_Concat(val1, val2);
return true;
}
#if PY_MAJOR_VERSION < 3
- if (PyString_Check(val1) && PyString_Check(val2)) {
+ if (PyString_Check(*val1) && PyString_Check(val2)) {
PyString_Concat(val1, val2);
return true;
}