summaryrefslogtreecommitdiffstats
path: root/sip/qt/qstring.sip
diff options
context:
space:
mode:
Diffstat (limited to 'sip/qt/qstring.sip')
-rw-r--r--sip/qt/qstring.sip32
1 files changed, 3 insertions, 29 deletions
diff --git a/sip/qt/qstring.sip b/sip/qt/qstring.sip
index d06fec1..a09e68d 100644
--- a/sip/qt/qstring.sip
+++ b/sip/qt/qstring.sip
@@ -604,11 +604,7 @@ public:
TQString operator[](SIP_PYSLICE) const;
%MethodCode
-#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t len, start, stop, step, slicelength, i;
-#else
- int len, start, stop, step, slicelength, i;
-#endif
len = sipCpp -> length();
@@ -651,7 +647,7 @@ public:
// expected.
if (sipIsErr == NULL)
- return (SIPBytes_Check(sipPy) ||
+ return (PyBytes_Check(sipPy) ||
PyUnicode_Check(sipPy) ||
sipCanConvertToInstance(sipPy,sipClass_TQString,SIP_NO_CONVERTORS));
@@ -717,7 +713,7 @@ public:
enc = codec->fromUnicode(*sipCpp);
- if ((encobj = SIPBytes_FromString(enc.data())) != NULL)
+ if ((encobj = PyBytes_FromString(enc.data())) != NULL)
{
*sipPtrPtr = (void *)PyString_AS_STRING(encobj);
sipRes = PyString_GET_SIZE(encobj);
@@ -870,14 +866,8 @@ TQString *PyTQt_qt_PyObject_AsTQString(PyObject *obj)
}
else if (PyBytes_Check(obj))
{
- return new TQString(SIPBytes_AS_STRING(obj));
- }
-#if PY_MAJOR_VERSION < 3
- else if (PyString_Check(obj))
- {
- return new TQString(PyString_AS_STRING(obj));
+ return new TQString(PyBytes_AS_STRING(obj));
}
-#endif
return NULL;
}
@@ -917,11 +907,7 @@ const char *PyTQt_qt_encode(PyObject **s, TQApplication::Encoding encoding)
TQByteArray ba = codec->fromUnicode(qs);
delete qstr;
-#if PY_MAJOR_VERSION >= 3
obj = PyBytes_FromStringAndSize(ba.data(), ba.size());
-#else
- obj = PyString_FromStringAndSize(ba.data(), ba.size());
-#endif
}
else
{
@@ -931,26 +917,14 @@ const char *PyTQt_qt_encode(PyObject **s, TQApplication::Encoding encoding)
if (obj)
{
-#if PY_MAJOR_VERSION >= 3
es = PyBytes_AS_STRING(obj);
-#else
- es = PyString_AS_STRING(obj);
-#endif
}
}
-#if PY_MAJOR_VERSION >= 3
else if (PyBytes_Check(obj))
{
es = PyBytes_AS_STRING(obj);
Py_INCREF(obj);
}
-#else
- else if (PyString_Check(obj))
- {
- es = PyString_AS_STRING(obj);
- Py_INCREF(obj);
- }
-#endif
else if (PyObject_AsCharBuffer(obj, &es, &sz) >= 0)
{
Py_INCREF(obj);