diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-05 08:13:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-05 08:13:27 +0200 |
commit | 45bdefeb1e2be7d005dfdef5c7f85c3b98ca6123 (patch) | |
tree | 11d71afb96518f3f108ed8f45afaa321862d2301 /sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py | |
parent | 3dcef048966bf0783cec66bf7e63307a1182cadf (diff) | |
parent | 56637d5b7c386499feae6cd002c848190389c62b (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I235035ccd510bcb548ffde00244215192d06e600
Diffstat (limited to 'sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py')
-rw-r--r-- | sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py index 3d25c5690..a0367883a 100644 --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py @@ -85,20 +85,6 @@ def formatannotation(annotation, base_module=None): return annotation.__module__ + '.' + annotation.__qualname__ return repr(annotation) -# patching __repr__ to disable the __repr__ of typing.TypeVar: -""" - def __repr__(self): - if self.__covariant__: - prefix = '+' - elif self.__contravariant__: - prefix = '-' - else: - prefix = '~' - return prefix + self.__name__ -""" -def _typevar__repr__(self): - return "typing." + self.__name__ - # Note also that during the tests we have a different encoding that would # break the Python license decorated files without an encoding line. @@ -160,12 +146,18 @@ def list_modules(message): print(" {:23}".format(name), repr(module)[:70]) +orig_typing = True if sys.version_info >= (3,): import typing import inspect inspect.formatannotation = formatannotation else: - from shibokensupport import typing27 as typing + if "typing" not in sys.modules: + orig_typing = False + from shibokensupport import typing27 as typing + sys.modules["typing"] = typing + else: + import typing import inspect namespace = inspect.__dict__ from shibokensupport import backport_inspect as inspect @@ -174,7 +166,6 @@ else: inspect.__doc__ += _doc # force inspect to find all attributes. See "heuristic" in pydoc.py! inspect.__all__ = list(x for x in dir(inspect) if not x.startswith("_")) -typing.TypeVar.__repr__ = _typevar__repr__ # Fix the module names in typing if possible. This is important since # the typing names should be I/O compatible, so that typing.Dict @@ -206,7 +197,7 @@ def move_into_pyside_package(): put_into_package(PySide2.support.signature, importhandler) put_into_package(PySide2.support.signature.lib, enum_sig) - put_into_package(PySide2.support.signature, typing) + put_into_package(None if orig_typing else PySide2.support.signature, typing) put_into_package(PySide2.support.signature, inspect) from shibokensupport.signature import mapping |