aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-29 12:50:21 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-29 14:47:30 +0100
commit6294578f2c6374ec92cde94821f7949b5f8c477b (patch)
treeef9b5dea81663e64557e4d9b2776c3e9525f0980 /sources/shiboken2/generator
parentba46aa1ffb8f9172e4473bd38e5018c1d1611a78 (diff)
Fix Python 3.8 warnings about deprecated int conversions of enums/flags
Set Py_nb_index to the conversion method for flags and enums. Fixes warnings like: examples/widgets/widgets/tetrix.py:107: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. Task-number: PYSIDE-168 Task-number: PYSIDE-939 Change-Id: Id41a72474192b357afd3dacd0a2e2fc5e055775c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 765657099..8dbf999e2 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -4836,6 +4836,7 @@ void CppGenerator::writeFlagsNumberMethodsDefinition(QTextStream &s, const Abstr
s << INDENT << "{Py_nb_xor, (void *)" << cpythonName << "___xor__}," << endl;
s << INDENT << "{Py_nb_or, (void *)" << cpythonName << "___or__}," << endl;
s << INDENT << "{Py_nb_int, (void *)" << cpythonName << "_long}," << endl;
+ s << INDENT << "{Py_nb_index, (void *)" << cpythonName << "_long}," << endl;
s << "#ifndef IS_PY3K" << endl;
s << INDENT << "{Py_nb_long, (void *)" << cpythonName << "_long}," << endl;
s << "#endif" << endl;