summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-02-05 19:12:21 +0100
committerChristian Tismer <tismer@stackless.com>2019-02-06 13:36:31 +0000
commit44c46d25f63f986c53df35150a8953724d77f8b3 (patch)
treee4c0efa1fbc6120f6c96a819cb354c664929b876
parentb10d326b207186258605548c572166e717c8f1a6 (diff)
Type Hints: Handle Container Types Correctly: Addendum
The correction to container types has a small bug which does not exist in reality, but could give a problem in the future: - We need not only avoid instantiation in Missing, but generally in all _NotCalled classes. Otherwise, when called during processing of container types, they would loose their (Missing, Default, ...whatever) tag. Change-Id: I4eb154100da6f3067b816c190af314b2a710ff39 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside2/PySide2/support/signature/mapping.py1
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/parser.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside2/PySide2/support/signature/mapping.py b/sources/pyside2/PySide2/support/signature/mapping.py
index d56d9745..2b234ecd 100644
--- a/sources/pyside2/PySide2/support/signature/mapping.py
+++ b/sources/pyside2/PySide2/support/signature/mapping.py
@@ -52,6 +52,7 @@ in sys.modules. This minimizes the loading overhead.
import PySide2
from signature_loader.sbk_mapping import *
+from signature_loader.sbk_mapping import _NotCalled
Sbk_Reloader = Reloader
diff --git a/sources/shiboken2/shibokenmodule/support/signature/parser.py b/sources/shiboken2/shibokenmodule/support/signature/parser.py
index 3b09dd4f..5c9a1e4f 100644
--- a/sources/shiboken2/shibokenmodule/support/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/support/signature/parser.py
@@ -46,7 +46,7 @@ import types
import keyword
import functools
from signature_loader.mapping import (type_map, update_mapping, namespace,
- typing, Missing)
+ typing, _NotCalled)
_DEBUG = False
LIST_KEYWORDS = False
@@ -218,7 +218,7 @@ def _resolve_type(thing, line):
contr = to_string(_resolve_type(contr, line))
thing = to_string(_resolve_type(thing, line))
result = "{contr}[{thing}]".format(**locals())
- if not isinstance(thing, Missing):
+ if not isinstance(thing, _NotCalled):
result = eval(result, namespace)
return result
return _resolve_value(thing, None, line)