aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/shibokenmodule')
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py5
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py8
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py10
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py15
4 files changed, 22 insertions, 16 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
index 352644f7a..47ab89ab8 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
@@ -96,12 +96,11 @@ def matched_type(args, sigs):
def seterror_argument(args, func_name, info):
- func = None
try:
func = eval(func_name, namespace)
except Exception as e:
- msg = "Internal error evaluating {func_name}: {e}".format(**locals())
- return TypeError, msg
+ msg = "Error evaluating `{func_name}`: {e}".format(**locals())
+ return type(e), msg
if info and type(info) is str:
err = TypeError
if info == "<":
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
index 24e75e42c..c8dbd51cc 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py
@@ -47,6 +47,7 @@ On the function with_metaclass see the answer from Martijn Pieters on
https://stackoverflow.com/questions/18513821/python-metaclass-understanding-the-with-metaclass
"""
+from inspect import currentframe
from textwrap import dedent
@@ -151,4 +152,11 @@ def with_metaclass(meta, *bases):
return meta.__prepare__(name, bases)
return type.__new__(metaclass, 'temporary_class', (), {})
+
+# A handy tool that shows the current line number and indents.
+def lno(level):
+ lineno = currentframe().f_back.f_lineno
+ spaces = level * " "
+ return "{}{}".format(lineno, spaces)
+
# eof
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
index 92511df32..fa6c6c2f1 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
@@ -57,6 +57,12 @@ from shibokensupport.signature import typing
from shibokensupport.signature.typing import TypeVar, Generic
from shibokensupport.signature.lib.tool import with_metaclass
+if sys.version_info[0] == 3:
+ # Avoid a deprecation warning
+ from _imp import is_builtin
+else:
+ from imp import is_builtin
+
class ellipsis(object):
def __repr__(self):
return "..."
@@ -181,7 +187,8 @@ class Reloader(object):
if getattr(mod, "__file__", None) and not os.path.isdir(mod.__file__):
ending = os.path.splitext(mod.__file__)[-1]
return ending not in (".py", ".pyc", ".pyo", ".pyi")
- return False
+ # Python 2 leaves lots of empty crap in sys.modules
+ return bool(hasattr(mod, "__name__") and is_builtin(mod.__name__))
def update(self):
"""
@@ -300,6 +307,7 @@ type_map.update({
"zero(object)": None,
"zero(str)": "",
"zero(typing.Any)": None,
+ "zero(Any)": None,
})
type_map.update({
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index a1cb58074..3e448d9e5 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -43,10 +43,11 @@ import sys
import re
import warnings
import types
+import typing
import keyword
import functools
from shibokensupport.signature.mapping import (type_map, update_mapping,
- namespace, typing, _NotCalled, ResultVariable, ArrayLikeVariable)
+ namespace, _NotCalled, ResultVariable, ArrayLikeVariable)
from shibokensupport.signature.lib.tool import (SimpleNamespace,
build_brace_pattern)
@@ -222,7 +223,7 @@ def _resolve_arraytype(thing, line):
def to_string(thing):
if isinstance(thing, str):
return thing
- if hasattr(thing, "__name__"):
+ if hasattr(thing, "__name__") and thing.__module__ != "typing":
dot = "." in str(thing)
name = get_name(thing)
return thing.__module__ + "." + name if dot else name
@@ -239,16 +240,6 @@ def handle_matrix(arg):
return eval(result, namespace)
-debugging_aid = """
-from inspect import currentframe
-
-def lno(level):
- lineno = currentframe().f_back.f_lineno
- spaces = level * " "
- return "{lineno}{spaces}".format(**locals())
-"""
-
-
def _resolve_type(thing, line, level, var_handler):
# Capture total replacements, first. Happens in
# "PySide2.QtCore.QCborStreamReader.StringResult[PySide2.QtCore.QByteArray]"