Skip to content

Commit

Permalink
Use try/except for ParamSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
last-partizan committed May 20, 2022
1 parent 1f22b84 commit 268a3bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 6 additions & 1 deletion src/decopatch/main.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 268a3bd

Please sign in to comment.