diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-19 23:34:11 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-19 23:34:11 +0900 |
commit | 1c362264d328c8886d33061ab992750741f7933a (patch) | |
tree | c56b482a6539c2992c97f3fe1bcb4d8ec46ef53f /sip/qt/qobject.sip | |
parent | 6054548c2546819cb0413bf6438087f5fe8f4ab4 (diff) | |
download | pytqt-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/qobject.sip')
-rw-r--r-- | sip/qt/qobject.sip | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/sip/qt/qobject.sip b/sip/qt/qobject.sip index b6e0387..c0c30e5 100644 --- a/sip/qt/qobject.sip +++ b/sip/qt/qobject.sip @@ -337,11 +337,7 @@ public: // the true (Python) class name. SIP_PYOBJECT className() const; %MethodCode -#if PY_MAJOR_VERSION >= 3 sipRes = PyUnicode_FromString(sipSelf->ob_type->tp_name); -#else - sipRes = sipClassName(sipSelf); -#endif %End // Note that tr() and trUtf8() are really static methods. We pretend @@ -621,11 +617,11 @@ SIP_PYOBJECT SLOT(const char * /Encoding="ASCII"/) /TypeHint="QT_SLOT"/; { int len = strlen(a0); - if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL) + if ((sipRes = PyBytes_FromStringAndSize(NULL,1 + len)) == NULL) sipIsErr = 1; else { - char *dp = SIPBytes_AS_STRING(sipRes); + char *dp = PyBytes_AS_STRING(sipRes); *dp++ = '1'; @@ -646,11 +642,11 @@ SIP_PYOBJECT SIGNAL(const char * /Encoding="ASCII"/) /TypeHint="QT_SIGNAL"/; { int len = strlen(a0); - if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL) + if ((sipRes = PyBytes_FromStringAndSize(NULL,1 + len)) == NULL) sipIsErr = 1; else { - char *dp = SIPBytes_AS_STRING(sipRes); + char *dp = PyBytes_AS_STRING(sipRes); *dp++ = '2'; @@ -671,11 +667,11 @@ SIP_PYOBJECT PYSIGNAL(const char * /Encoding="ASCII"/); { int len = strlen(a0); - if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL) + if ((sipRes = PyBytes_FromStringAndSize(NULL,1 + len)) == NULL) sipIsErr = 1; else { - char *dp = SIPBytes_AS_STRING(sipRes); + char *dp = PyBytes_AS_STRING(sipRes); *dp++ = '9'; @@ -736,12 +732,7 @@ extern "C" { // The meta-type for PyTQt classes. It is just a marker type so that we can // safely cast to get access to PyTQt3-specific data structures. PyTypeObject pyqtWrapperType_Type = { -#if PY_MAJOR_VERSION >= 3 PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif "qt.pyqtWrapperType", /* tp_name */ sizeof (sipWrapperType), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -755,10 +746,8 @@ PyTypeObject pyqtWrapperType_Type = { 0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03050000 0, /* tp_as_async */ -#elif PY_VERSION_HEX >= 0x03010000 - 0, /* tp_reserved */ #else - 0, /* tp_compare */ + 0, /* tp_reserved */ #endif 0, /* tp_repr */ 0, /* tp_as_number */ @@ -797,16 +786,14 @@ PyTypeObject pyqtWrapperType_Type = { 0, /* tp_subclasses */ 0, /* tp_weaklist */ 0, /* tp_del */ -#if PY_VERSION_HEX >= 0x02060000 0, /* tp_version_tag */ -#endif #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif #if PY_VERSION_HEX >= 0x03080000 0, /* tp_vectorcall */ #endif -#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 8 +#if PY_VERSION_HEX == 0x03080000 0, /* tp_print (deprecated) */ #endif }; @@ -963,12 +950,7 @@ static sipWrapperType pyqtWrapper_Type = { { #endif { -#if PY_MAJOR_VERSION >= 3 PyVarObject_HEAD_INIT(&pyqtWrapperType_Type, 0) -#else - PyObject_HEAD_INIT(&pyqtWrapperType_Type) - 0, /* ob_size */ -#endif "qt.pyqtWrapper", /* tp_name */ sizeof (pyqtWrapper), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -982,10 +964,8 @@ static sipWrapperType pyqtWrapper_Type = { 0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03050000 0, /* tp_as_async */ -#elif PY_VERSION_HEX >= 0x03010000 - 0, /* tp_reserved */ #else - 0, /* tp_compare */ + 0, /* tp_reserved */ #endif 0, /* tp_repr */ 0, /* tp_as_number */ @@ -1024,16 +1004,14 @@ static sipWrapperType pyqtWrapper_Type = { 0, /* tp_subclasses */ 0, /* tp_weaklist */ 0, /* tp_del */ -#if PY_VERSION_HEX >= 0x02060000 0, /* tp_version_tag */ -#endif #if PY_VERSION_HEX >= 0x03040000 0, /* tp_finalize */ #endif #if PY_VERSION_HEX >= 0x03080000 0, /* tp_vectorcall */ #endif -#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 8 +#if PY_VERSION_HEX == 0x03080000 0, /* tp_print (deprecated) */ #endif }, @@ -1286,13 +1264,13 @@ bool UniversalSlot::tqt_invoke(int id, TQUObject *qargs) case char_sat: case schar_sat: case uchar_sat: - arg = SIPBytes_FromStringAndSize((char *)static_QUType_ptr.get(qargs), 1); + arg = PyBytes_FromStringAndSize((char *)static_QUType_ptr.get(qargs), 1); break; case string_sat: case sstring_sat: case ustring_sat: - arg = SIPBytes_FromString((char *)static_QUType_ptr.get(qargs)); + arg = PyBytes_FromString((char *)static_QUType_ptr.get(qargs)); break; case short_sat: @@ -2097,11 +2075,7 @@ PyObject *pyqt3GetSender() Py_FatalError("qt: Failed to register pyqtWrapperType type"); // Initialise the super-type. -#if PY_VERSION_HEX >= 0x02050000 pyqtWrapper_Type.super.ht_type.tp_base = sipWrapper_Type; -#else - pyqtWrapper_Type.super.type.tp_base = sipWrapper_Type; -#endif if (PyType_Ready((PyTypeObject *)&pyqtWrapper_Type) < 0) Py_FatalError("qt: Failed to initialise pyqtWrapper type"); |