aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-02-21 10:54:30 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-02-21 13:28:23 +0100
commit19eb0b01f4031c7897f98c73e178636b56bc7fb1 (patch)
tree9e289034e21d94f906353e02d7510f75049ec3da
parent1d77048c1de842c0dce9e78bd0c7763da2689cf2 (diff)
Fix the multimap/hash conversion and add the test
Avoid iterating over end by removing the increment from the outer loop. Amends 20b207f41b72f857acc1a747ea06f4f657d7d1ea. Pick-to: 6.2 Change-Id: I1adba4c847fa060f594e6eb0c7d2e48356bd1746 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/pyside6/tests/pysidetest/CMakeLists.txt1
-rw-r--r--sources/shiboken6/ApiExtractor/predefined_templates.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside6/tests/pysidetest/CMakeLists.txt b/sources/pyside6/tests/pysidetest/CMakeLists.txt
index 9fec250b5..a6029a81e 100644
--- a/sources/pyside6/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside6/tests/pysidetest/CMakeLists.txt
@@ -132,6 +132,7 @@ add_dependencies(testbinding pyside6 QtCore QtGui QtWidgets pysidetest)
create_generator_target(testbinding)
PYSIDE_TEST(constructor_properties_test.py)
+PYSIDE_TEST(container_test.py)
PYSIDE_TEST(decoratedslot_test.py)
PYSIDE_TEST(delegatecreateseditor_test.py)
PYSIDE_TEST(all_modules_load_test.py)
diff --git a/sources/shiboken6/ApiExtractor/predefined_templates.cpp b/sources/shiboken6/ApiExtractor/predefined_templates.cpp
index bd834c00b..6227b18f3 100644
--- a/sources/shiboken6/ApiExtractor/predefined_templates.cpp
+++ b/sources/shiboken6/ApiExtractor/predefined_templates.cpp
@@ -104,7 +104,7 @@ while (PyDict_Next(%in, &pos, &key, &value)) {
static QString cppMultiMapToPyDict(bool isQMultiMap)
{
return uR"(PyObject *%out = PyDict_New();
- for (auto it = %in.cbegin(), end = %in.cend(); it != end; ++it) {
+ for (auto it = %in.cbegin(), end = %in.cend(); it != end; ) {
const auto &key = it)"_qs
+ QLatin1String(isQMultiMap ? qtMapKeyAccessor : stlMapKeyAccessor)
+ uR"(;
@@ -130,7 +130,7 @@ static QString cppMultiMapToPyDict(bool isQMultiMap)
static QString cppMultiHashToPyDict(bool isQMultiHash)
{
return uR"(PyObject *%out = PyDict_New();
- for (auto it = %in.cbegin(), end = %in.cend(); it != end; ++it) {
+ for (auto it = %in.cbegin(), end = %in.cend(); it != end; ) {
const auto &key = it)"_qs
+ QLatin1String(isQMultiHash ? qtMapKeyAccessor : stlMapKeyAccessor)
+ uR"(;