aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py')
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 20c791cc1..a1cb58074 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -196,7 +196,7 @@ def _resolve_value(thing, valtype, line):
if res is not None:
type_map[thing] = res
return res
- warnings.warn("""pyside_type_init:
+ warnings.warn("""pyside_type_init:_resolve_value
UNRECOGNIZED: {!r}
OFFENDING LINE: {!r}
@@ -277,7 +277,15 @@ def _resolve_type(thing, line, level, var_handler):
pieces.append(to_string(part))
thing = ", ".join(pieces)
result = "{contr}[{thing}]".format(**locals())
- return eval(result, namespace)
+ # PYSIDE-1538: Make sure that the eval does not crash.
+ try:
+ return eval(result, namespace)
+ except Exception as e:
+ warnings.warn("""pyside_type_init:_resolve_type
+
+ UNRECOGNIZED: {!r}
+ OFFENDING LINE: {!r}
+ """.format(result, line), RuntimeWarning)
return _resolve_value(thing, None, line)
@@ -380,7 +388,9 @@ def fix_variables(props, line):
if not isinstance(ann, ResultVariable):
continue
# We move the variable to the end and remove it.
- retvars.append(ann.type)
+ # PYSIDE-1409: If the variable was the first arg, we move it to the front.
+ # XXX This algorithm should probably be replaced by more introspection.
+ retvars.insert(0 if idx == 0 else len(retvars), ann.type)
deletions.append(idx)
del annos[name]
for idx in reversed(deletions):