diff --git a/setup.cfg b/setup.cfg index d80e072..ed9ef4e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,7 @@ install_requires = # we're using typing_extensions even for new versions of python, so we don't pollute our code # with try/except every time we use new feature. # typing_extensions will use version from typing module if it detects new enough python. - typing-extensions>=4.2;python_version>='3.6' + typing-extensions>=4.2;python_version>='3.6',<'3.10' # note: do not use double quotes in these, this triggers a weird bug in PyCharm in debug mode only funcsigs;python_version<'3.3' enum34;python_version<'3.4' diff --git a/src/decopatch/main.pyi b/src/decopatch/main.pyi index 1dd410d..1cdeb76 100644 --- a/src/decopatch/main.pyi +++ b/src/decopatch/main.pyi @@ -1,6 +1,11 @@ from typing import Any, Callable, Optional, Protocol, TypeVar, overload -from typing_extensions import ParamSpec +try: + # We're importing typing_extensions version first, becouse it will + # detect best available implementation depending on python version. + from typing_extensions import ParamSpec +except ImportError: + from typing import ParamSpec from decopatch.utils_disambiguation import FirstArgDisambiguation from decopatch.utils_modes import SignatureInfo