summaryrefslogtreecommitdiffstats
path: root/sip/qt/qbytearray.sip
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-01-19 23:34:11 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-01-19 23:34:11 +0900
commit1c362264d328c8886d33061ab992750741f7933a (patch)
treec56b482a6539c2992c97f3fe1bcb4d8ec46ef53f /sip/qt/qbytearray.sip
parent6054548c2546819cb0413bf6438087f5fe8f4ab4 (diff)
downloadpytqt-1c362264d328c8886d33061ab992750741f7933a.tar.gz
pytqt-1c362264d328c8886d33061ab992750741f7933a.zip
Remove/replace old conditional python code.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'sip/qt/qbytearray.sip')
-rw-r--r--sip/qt/qbytearray.sip14
1 files changed, 4 insertions, 10 deletions
diff --git a/sip/qt/qbytearray.sip b/sip/qt/qbytearray.sip
index d975472..f25ecd6 100644
--- a/sip/qt/qbytearray.sip
+++ b/sip/qt/qbytearray.sip
@@ -115,11 +115,7 @@ static PyObject* TQByteArray_To_String(TQByteArray *ba)
if (data)
{
-#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromStringAndSize(data, len);
-#else
- return SIPBytes_FromStringAndSize(data, len);
-#endif
}
else
{
@@ -178,7 +174,7 @@ public:
if (res == Py_None)
{
- sipRes = SIPBytes_FromString("");
+ sipRes = PyBytes_FromString("");
}
else
{
@@ -191,7 +187,7 @@ public:
// Allow a Python string whenever a TQByteArray is expected.
if (sipIsErr == NULL)
- return (SIPBytes_Check(sipPy) ||
+ return (PyBytes_Check(sipPy) ||
PyUnicode_Check(sipPy) ||
sipCanConvertToInstance(sipPy,sipClass_TQByteArray,SIP_NO_CONVERTORS));
@@ -210,7 +206,6 @@ public:
return sipGetState(sipTransferObj);
}
-#if PY_VERSION_HEX >= 0x02060000
else if (PyByteArray_Check(sipPy))
{
Py_BEGIN_ALLOW_THREADS
@@ -223,13 +218,12 @@ public:
return sipGetState(sipTransferObj);
}
-#endif
- else if (SIPBytes_Check(sipPy))
+ else if (PyBytes_Check(sipPy))
{
Py_BEGIN_ALLOW_THREADS
TQByteArray *ba = new TQByteArray();
- ba -> duplicate(SIPBytes_AS_STRING(sipPy),SIPBytes_GET_SIZE(sipPy));
+ ba -> duplicate(PyBytes_AS_STRING(sipPy),PyBytes_GET_SIZE(sipPy));
*sipCppPtr = ba;
Py_END_ALLOW_THREADS