From 3e358241ccdb0910a32ff519ae1708f84845e06c Mon Sep 17 00:00:00 2001 From: Adam Kunesh <94334440+fennel-akunesh@users.noreply.github.com> Date: Sat, 2 Dec 2023 02:17:33 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20import=20for=20Protocols?= =?UTF-8?q?=20support=20regardless=20of=20Python=20version=20(#48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rodi/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rodi/__init__.py b/rodi/__init__.py index d367dde..7f27091 100644 --- a/rodi/__init__.py +++ b/rodi/__init__.py @@ -20,10 +20,11 @@ get_type_hints, ) -if sys.version_info >= (3, 9): # pragma: no cover - from typing import _no_init_or_replace_init as _no_init -elif sys.version_info >= (3, 8): # pragma: no cover - from typing import _no_init +if sys.version_info >= (3, 8): # pragma: no cover + try: + from typing import _no_init_or_replace_init as _no_init + except ImportError: # pragma: no cover + from typing import _no_init try: from typing import Protocol