diff options
author | Christian Tismer <tismer@stackless.com> | 2022-08-30 16:57:55 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2022-09-02 12:15:35 +0200 |
commit | 9b41055fe043a1f190a06e0cc8b4fc82398261b9 (patch) | |
tree | ad238aa10c27de676ae2ac2d795bfac81e39c42a | |
parent | 042413450f6b6e95241c2b6bcad7917173fd26ce (diff) |
PyEnum: Simplify code generator because of full forgiveness
PyEnum needed extra signature handling in the parser.py file
and the abstractmetatype.cpp file because we needed to decide
at runtime what names are to be generated.
With the full forgiveness mode, all special handling is
still implemented, but the old versions of the enum
representation can also always be used.
The unexpected funny side effect is that we now can remove
all special handling that has been implemented for these cases.
The way how things are written is no longer relevant, although
the new version is still the only one advertized.
Change-Id: I76efc8ffc646d3a04d974d6776a1c9c2b5ffec70
Task-number: PYSIDE-1735
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 5419080e948c89d4f271d7d4a9bf980f647d53f5)
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetatype.cpp | 12 | ||||
-rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py | 12 |
2 files changed, 2 insertions, 22 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp index d47b25ef2..b5fa4100c 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp @@ -668,16 +668,8 @@ QString AbstractMetaTypeData::formatPythonSignature() const result += TypeInfo::indirectionKeyword(i); // If it is a flags type, we replace it with the full name: // "PySide6.QtCore.Qt.ItemFlags" instead of "PySide6.QtCore.QFlags<Qt.ItemFlag>" - if (m_typeEntry->isFlags()) { - // PYSIDE-1735: We need to provide both the flags type and the original enum type - // as a choice at runtime. - auto flagsTypeEntry = static_cast<const FlagsTypeEntry *>(m_typeEntry); - auto enumTypeEntry = flagsTypeEntry->originator(); - result = m_typeEntry->targetLangPackage() + u".^^"_s - + flagsTypeEntry->targetLangName() + u"^^"_s - + enumTypeEntry->targetLangName() + u"^^"_s; - } - + if (m_typeEntry->isFlags()) + result = m_typeEntry->qualifiedTargetLangName(); result.replace(u"::"_s, u"."_s); return result; } diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py index 1d4dadc55..c877f1ee4 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py @@ -434,18 +434,6 @@ def handle_retvar(obj): def calculate_props(line): - # PYSIDE-1735: QFlag is now divided into fields for future Python Enums, like - # "PySide.QtCore.^^Qt.ItemFlags^^Qt.ItemFlag^^" - # Resolve that until Enum is finally settled. - while "^^" in line: - parts = line.split("^^", 3) - selected = EnumSelect.SELECTION - line = parts[0] + parts[selected.value] + parts[3] - if selected is EnumSelect.NEW: - _old, _new = EnumSelect.OLD.value, EnumSelect.NEW.value - line = re.sub(rf"\b{parts[_old]}\b", parts[_new], line) - type_map[parts[_old]] = parts[_new] - parsed = SimpleNamespace(**_parse_line(line.strip())) arglist = parsed.arglist annotations = {} |