diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-06-22 14:14:29 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-06-22 14:25:20 +0300 |
commit | b41b2afa94a8d2a34ca61d8add00730c1f09d110 (patch) | |
tree | dadc24f0e9255c1750268a5d5188a991e27876dc | |
parent | ec6419ce54cc774514785609c6fa060f73af4bd1 (diff) | |
download | ydb-b41b2afa94a8d2a34ca61d8add00730c1f09d110.tar.gz |
Intermediate changes
-rw-r--r-- | contrib/python/typing-extensions/py3/.dist-info/METADATA | 2 | ||||
-rw-r--r-- | contrib/python/typing-extensions/py3/typing_extensions.py | 17 | ||||
-rw-r--r-- | contrib/python/typing-extensions/py3/ya.make | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/contrib/python/typing-extensions/py3/.dist-info/METADATA b/contrib/python/typing-extensions/py3/.dist-info/METADATA index 4972751951..f15e2b3877 100644 --- a/contrib/python/typing-extensions/py3/.dist-info/METADATA +++ b/contrib/python/typing-extensions/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: typing_extensions -Version: 4.12.1 +Version: 4.12.2 Summary: Backported and Experimental Type Hints for Python 3.8+ Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing Author-email: "Guido van Rossum, Jukka Lehtosalo, Ćukasz Langa, Michael Lee" <levkivskyi@gmail.com> diff --git a/contrib/python/typing-extensions/py3/typing_extensions.py b/contrib/python/typing-extensions/py3/typing_extensions.py index 46084fa56f..dec429ca87 100644 --- a/contrib/python/typing-extensions/py3/typing_extensions.py +++ b/contrib/python/typing-extensions/py3/typing_extensions.py @@ -2954,13 +2954,20 @@ if not _PEP_696_IMPLEMENTED: def _has_generic_or_protocol_as_origin() -> bool: try: frame = sys._getframe(2) - # not all platforms have sys._getframe() - except AttributeError: + # - Catch AttributeError: not all Python implementations have sys._getframe() + # - Catch ValueError: maybe we're called from an unexpected module + # and the call stack isn't deep enough + except (AttributeError, ValueError): return False # err on the side of leniency else: - return frame.f_locals.get("origin") in ( - typing.Generic, Protocol, typing.Protocol - ) + # If we somehow get invoked from outside typing.py, + # also err on the side of leniency + if frame.f_globals.get("__name__") != "typing": + return False + origin = frame.f_locals.get("origin") + # Cannot use "in" because origin may be an object with a buggy __eq__ that + # throws an error. + return origin is typing.Generic or origin is Protocol or origin is typing.Protocol _TYPEVARTUPLE_TYPES = {TypeVarTuple, getattr(typing, "TypeVarTuple", None)} diff --git a/contrib/python/typing-extensions/py3/ya.make b/contrib/python/typing-extensions/py3/ya.make index e4787d155f..69f363f940 100644 --- a/contrib/python/typing-extensions/py3/ya.make +++ b/contrib/python/typing-extensions/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(4.12.1) +VERSION(4.12.2) LICENSE(PSF-2.0) |