diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-24 19:43:01 +0900 | 
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-31 20:42:36 +0900 | 
| commit | 244f8405a7d3f1db7f128f07bcd1ed3c31a5beae (patch) | |
| tree | 5b5b6298aff2c80e15987f012e7992e24ad6576e | |
| parent | 27f46d6031d41aa6ce071885a7e280e1097680e1 (diff) | |
| download | pytqt-244f8405.tar.gz pytqt-244f8405.zip | |
Add support for python 3.12 and raise minimum required version to 3.4.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 15eb6c387b2bfd9f54bd8223d483dd8c3998ea2e)
| -rw-r--r-- | sip/tqt/tqbytearray.sip | 6 | ||||
| -rw-r--r-- | sip/tqt/tqobject.sip | 4 | ||||
| -rw-r--r-- | sip/tqt/tqstring.sip | 35 | 
3 files changed, 1 insertions, 44 deletions
| diff --git a/sip/tqt/tqbytearray.sip b/sip/tqt/tqbytearray.sip index f25ecd6..de5407a 100644 --- a/sip/tqt/tqbytearray.sip +++ b/sip/tqt/tqbytearray.sip @@ -196,11 +196,7 @@ public:  		Py_BEGIN_ALLOW_THREADS  		TQByteArray *ba = new TQByteArray(); -#if PY_VERSION_HEX >= 0x03030000 -		ba -> duplicate((char *)PyUnicode_1BYTE_DATA(sipPy),PyUnicode_GET_SIZE(sipPy)); -#else -		ba -> duplicate((char *)PyUnicode_AS_DATA(sipPy),PyUnicode_GET_SIZE(sipPy)); -#endif +		ba -> duplicate((char *)PyUnicode_1BYTE_DATA(sipPy),(uint)PyUnicode_GET_LENGTH(sipPy));  		*sipCppPtr = ba;  		Py_END_ALLOW_THREADS diff --git a/sip/tqt/tqobject.sip b/sip/tqt/tqobject.sip index 20aa579..ef2ddc5 100644 --- a/sip/tqt/tqobject.sip +++ b/sip/tqt/tqobject.sip @@ -787,9 +787,7 @@ PyTypeObject pytqtWrapperType_Type = {      0,                      /* tp_weaklist */      0,                      /* tp_del */      0,                      /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000      0,                      /* tp_finalize */ -#endif  #if PY_VERSION_HEX >= 0x03080000      0,                      /* tp_vectorcall */  #endif @@ -1005,9 +1003,7 @@ static sipWrapperType pytqtWrapper_Type = {              0,              /* tp_weaklist */              0,              /* tp_del */              0,              /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000              0,              /* tp_finalize */ -#endif  #if PY_VERSION_HEX >= 0x03080000              0,              /* tp_vectorcall */  #endif diff --git a/sip/tqt/tqstring.sip b/sip/tqt/tqstring.sip index 116140e..8ef101f 100644 --- a/sip/tqt/tqstring.sip +++ b/sip/tqt/tqstring.sip @@ -752,7 +752,6 @@ PyObject *PyTQt_tqt_PyObject_FromTQString(const TQString *tqstr)  {      PyObject *obj; -#if PY_VERSION_HEX >= 0x03030000      // We have to work out exactly which kind to use.  We assume ASCII while we      // are checking so that we only go through the string once in the most      // common case.  Note that we can't use PyUnicode_FromKindAndData() because @@ -787,24 +786,6 @@ PyObject *PyTQt_tqt_PyObject_FromTQString(const TQString *tqstr)          Py_UCS4 uch = tqstr->at(tqt_i).unicode();          PyUnicode_WRITE(kind, data, tqt_i, uch);      } -#elif defined(Py_UNICODE_WIDE) -    // Note that this doesn't handle code points greater than 0xffff.  It could -    // but it's only an issue for old versions of TQt. - -    if ((obj = PyUnicode_FromUnicode(NULL, tqstr->length())) == NULL) -        return NULL; - -    Py_UNICODE *pyu = PyUnicode_AS_UNICODE(obj); - -    for (unsigned int i = 0; i < tqstr->length(); ++i) -        *pyu++ = (tqstr->at(i)).unicode(); -#else -    if ((obj = PyUnicode_FromUnicode(NULL, tqstr->length())) == NULL) -        return NULL; - -    memcpy(PyUnicode_AS_UNICODE(obj), tqstr->ucs2(), -            tqstr->length() * sizeof (Py_UNICODE)); -#endif      return obj;  } @@ -821,7 +802,6 @@ TQString *PyTQt_tqt_PyObject_AsTQString(PyObject *obj)  {      if (PyUnicode_Check(obj))      { -#if PY_VERSION_HEX >= 0x03030000          SIP_SSIZE_T len = PyUnicode_GET_LENGTH(obj);          switch (PyUnicode_KIND(obj)) @@ -848,21 +828,6 @@ TQString *PyTQt_tqt_PyObject_AsTQString(PyObject *obj)          }          return NULL; -#else -        TQString *tqstr = new TQString; - -# ifdef Py_UNICODE_WIDE -        Py_UNICODE *ucode = PyUnicode_AS_UNICODE(obj); -        SIP_SSIZE_T len = PyUnicode_GET_SIZE(obj); - -        for (SIP_SSIZE_T i = 0; i < len; ++i) -            tqstr->append(TQChar((uint)ucode[i])); -# else -        tqstr->setUnicodeCodes((ushort *)PyUnicode_AS_UNICODE(obj),PyUnicode_GET_SIZE(obj)); -# endif - -        return tqstr; -#endif      }      else if (PyBytes_Check(obj))      { | 
