diff options
author | Jaime Resano <Jaime.RESANO-AISA@qt.io> | 2025-04-23 23:14:07 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-04-25 05:38:17 +0000 |
commit | 64a0e8bad7e2c3d74b216aff0c57983280efcede (patch) | |
tree | f22cea34c80908cc0c2ffeea0f2cecf181a24c96 | |
parent | 70f11d5bd4263b0b29f06cbf7a6ff083c882c376 (diff) |
This patch fixes a crash of the pyside6-metaobjectdump tool run in a
file that contains a @Slot(result=None) decorator.
The fix contains in improving the existing _name function to handle
ast.Constant nodes.
Fixes: PYSIDE-3089
Pick-to: 6.9
Change-Id: Id006898021efbc2cc0f9a48f2ce5ac94fcef1836
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | sources/pyside-tools/metaobjectdump.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/pyside-tools/metaobjectdump.py b/sources/pyside-tools/metaobjectdump.py index d14c3334a..f3c0c5606 100644 --- a/sources/pyside-tools/metaobjectdump.py +++ b/sources/pyside-tools/metaobjectdump.py @@ -70,9 +70,11 @@ def _attribute(node: ast.Attribute) -> tuple[str, str]: return node.value.id, node.attr -def _name(node: ast.Name | ast.Attribute) -> str: +def _name(node: ast.Name | ast.Attribute | ast.Constant) -> str: """Return the name of something that is either an attribute or a name, such as base classes or call.func""" + if isinstance(node, ast.Constant): + return str(node.value) if isinstance(node, ast.Attribute): qualifier, name = _attribute(node) return f"{qualifier}.{node.attr}" |