aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/feature_select.cpp
diff options
context:
space:
mode:
authorChristian Tismer <[email protected]>2021-08-04 12:27:17 +0200
committerChristian Tismer <[email protected]>2021-08-06 00:06:45 +0200
commita21203d534c2947a2e5f472ace3e83c552e83191 (patch)
tree99b0b5a81bfc9c885a830f36543ba97790f95b35 /sources/pyside6/libpyside/feature_select.cpp
parent521dc4b6dcdd7d04a9ef6afe273833016f7ba31c (diff)
Shiboken: Remove cheating macros
There are a number of cheating macros that allow to use the same code in Python 2 and 3. Because Python 2 is gone, remove these macros. This conversion was partially difficult since certain types collapsed in the XML files and generated functions contained substrings of the macros. This is actually the fourth attempt. Task-number: PYSIDE-1019 Pick-to: 6.1 Change-Id: I116877afc8aa36f4710a40df1769f600b6b750ea Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'sources/pyside6/libpyside/feature_select.cpp')
-rw-r--r--sources/pyside6/libpyside/feature_select.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/sources/pyside6/libpyside/feature_select.cpp b/sources/pyside6/libpyside/feature_select.cpp
index 648ec96a3..492e30c28 100644
--- a/sources/pyside6/libpyside/feature_select.cpp
+++ b/sources/pyside6/libpyside/feature_select.cpp
@@ -187,7 +187,7 @@ static inline PyObject *getSelectId(PyObject *dict)
static inline void setCurrentSelectId(PyTypeObject *type, PyObject *select_id)
{
- SbkObjectType_SetReserved(type, PyInt_AsSsize_t(select_id)); // int/long cheating
+ SbkObjectType_SetReserved(type, PyLong_AsSsize_t(select_id)); // int/long cheating
}
static inline void setCurrentSelectId(PyTypeObject *type, int id)
@@ -217,7 +217,7 @@ static bool replaceClassDict(PyTypeObject *type)
if (new_dict == nullptr || PyDict_Update(new_dict, dict) < 0)
return false;
// Insert the default id. Cannot fail for small numbers.
- AutoDecRef select_id(PyInt_FromLong(0));
+ AutoDecRef select_id(PyLong_FromLong(0));
setSelectId(new_dict, select_id);
// insert the dict into itself as ring
setNextDict(new_dict, new_dict);
@@ -283,9 +283,9 @@ static bool createNewFeatureSet(PyTypeObject *type, PyObject *select_id)
* content in `prev_dict`. It is responsible of filling `type->tp_dict`
* with modified content.
*/
- static auto small_1 = PyInt_FromLong(255);
+ static auto small_1 = PyLong_FromLong(255);
Q_UNUSED(small_1);
- static auto small_2 = PyInt_FromLong(255);
+ static auto small_2 = PyLong_FromLong(255);
Q_UNUSED(small_2);
// make sure that small integers are cached
assert(small_1 != nullptr && small_1 == small_2);
@@ -299,7 +299,7 @@ static bool createNewFeatureSet(PyTypeObject *type, PyObject *select_id)
Py_INCREF(prev_dict); // keep the first ref unchanged
if (!addNewDict(type, select_id))
return false;
- auto id = PyInt_AsSsize_t(select_id); // int/long cheating
+ auto id = PyLong_AsSsize_t(select_id); // int/long cheating
if (id == -1)
return false;
setCurrentSelectId(type, id);
@@ -434,7 +434,7 @@ void init()
if (!is_initialized) {
fast_id_array = &_fast_id_array[1];
for (int idx = -1; idx < 256; ++idx)
- fast_id_array[idx] = PyInt_FromLong(idx);
+ fast_id_array[idx] = PyLong_FromLong(idx);
featurePointer = featureProcArray;
initSelectableFeature(SelectFeatureSet);
registerCleanupFunction(finalize);