Skip to content

Commit 5dcb3b7

Browse files
authored
Use stdlib typing.final in Python 3.8+ (#259)
The "final" decorator is part of the stdlib typing module since Python 3.8. Use it in new enough Python versions, and fall back to typing_extensions in older versions.
1 parent 3cda737 commit 5dcb3b7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGES/259.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use stdlib typing.final in Python 3.8+, limiting typing-extensions dependency to older Python versions.

async_timeout/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
from types import TracebackType
66
from typing import Any, Optional, Type
77

8-
from typing_extensions import final
8+
9+
if sys.version_info >= (3, 8):
10+
from typing import final
11+
else:
12+
from typing_extensions import final
913

1014

1115
__version__ = "4.0.1"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ zip_safe = True
4242
include_package_data = True
4343

4444
install_requires =
45-
typing_extensions>=3.6.5
45+
typing_extensions>=3.6.5; python_version < "3.8"
4646

4747

4848
[flake8]

0 commit comments

Comments
 (0)