Add support for python 3.12 and raise minimum required version to 3.3

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/17/head
Michele Calgaro 4 months ago
parent e44eaa6ec0
commit c35201f922
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -389,8 +389,8 @@ def main(argv):
""" """
siputils.inform("This is SIP-TQt %s for Python %s on %s platform." % (sip_version_str, sys.version.split()[0], sys.platform)) siputils.inform("This is SIP-TQt %s for Python %s on %s platform." % (sip_version_str, sys.version.split()[0], sys.platform))
if py_version < 0x020300: if py_version < 0x030300:
siputils.error("This version of SIP-TQt requires Python v2.3 or later.") siputils.error("This version of SIP-TQt requires Python v3.3 or later.")
global extra_lib_dir global extra_lib_dir

@ -46,8 +46,8 @@ extern "C" {
/* Sanity check on the Python version. */ /* Sanity check on the Python version. */
#if PY_VERSION_HEX < 0x03020000 #if PY_VERSION_HEX < 0x03030000
#error "This version of SIP-TQt requires Python v3.2 or later" #error "This version of SIP-TQt requires Python v3.3 or later"
#endif #endif

@ -9384,7 +9384,7 @@ static char sip_api_string_as_ascii_char(PyObject *obj)
if (parseString_AsASCIIChar(obj, &ch) < 0) if (parseString_AsASCIIChar(obj, &ch) < 0)
{ {
/* Use the exception set if it was an encoding error. */ /* Use the exception set if it was an encoding error. */
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1) if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"bytes or ASCII string of length 1 expected not '%s'", "bytes or ASCII string of length 1 expected not '%s'",
Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
@ -9416,7 +9416,7 @@ static char sip_api_string_as_latin1_char(PyObject *obj)
if (parseString_AsLatin1Char(obj, &ch) < 0) if (parseString_AsLatin1Char(obj, &ch) < 0)
{ {
/* Use the exception set if it was an encoding error. */ /* Use the exception set if it was an encoding error. */
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1) if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"bytes or Latin-1 string of length 1 expected not '%s'", "bytes or Latin-1 string of length 1 expected not '%s'",
Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
@ -9448,7 +9448,7 @@ static char sip_api_string_as_utf8_char(PyObject *obj)
if (parseString_AsUTF8Char(obj, &ch) < 0) if (parseString_AsUTF8Char(obj, &ch) < 0)
{ {
/* Use the exception set if it was an encoding error. */ /* Use the exception set if it was an encoding error. */
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1) if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"bytes or UTF-8 string of length 1 expected not '%s'", "bytes or UTF-8 string of length 1 expected not '%s'",
Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
@ -9757,7 +9757,7 @@ static int convertToWCharArray(PyObject *obj, wchar_t **ap, SIP_SSIZE_T *aszp)
SIP_SSIZE_T ulen; SIP_SSIZE_T ulen;
wchar_t *wc; wchar_t *wc;
ulen = PyUnicode_GET_SIZE(obj); ulen = PyUnicode_GET_LENGTH(obj);
if ((wc = sip_api_malloc(ulen * sizeof (wchar_t))) == NULL) if ((wc = sip_api_malloc(ulen * sizeof (wchar_t))) == NULL)
return -1; return -1;
@ -9794,7 +9794,7 @@ static int parseWChar(PyObject *obj, wchar_t *ap)
*/ */
static int convertToWChar(PyObject *obj, wchar_t *ap) static int convertToWChar(PyObject *obj, wchar_t *ap)
{ {
if (PyUnicode_GET_SIZE(obj) != 1) if (PyUnicode_GET_LENGTH(obj) != 1)
return -1; return -1;
if (PyUnicode_AsWideChar((PyUnicodeObject *)obj, ap, 1) != 1) if (PyUnicode_AsWideChar((PyUnicodeObject *)obj, ap, 1) != 1)
@ -9832,7 +9832,7 @@ static int convertToWCharString(PyObject *obj, wchar_t **ap)
SIP_SSIZE_T ulen; SIP_SSIZE_T ulen;
wchar_t *wc; wchar_t *wc;
ulen = PyUnicode_GET_SIZE(obj); ulen = PyUnicode_GET_LENGTH(obj);
if ((wc = sip_api_malloc((ulen + 1) * sizeof (wchar_t))) == NULL) if ((wc = sip_api_malloc((ulen + 1) * sizeof (wchar_t))) == NULL)
return -1; return -1;

Loading…
Cancel
Save