Skip to content

Commit bdb6cac

Browse files
authored
Keep runtime fallback for 3.7/3.8 compat
Because `Mapping` is not subscriptable until Python 3.9, the previous change introduced runtime errors for 3.7/3.8. Applies suggested workaround from @WilliamBergamin to continue using Dict at runtime until <3.9 is eventually dropped.
1 parent 8067096 commit bdb6cac

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

slack_sdk/signature/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
import hashlib
44
import hmac
5-
from collections.abc import Mapping
65
from time import time
7-
from typing import Optional, Union
6+
from typing import Dict, Optional, Union, TYPE_CHECKING
7+
8+
# Fallback to Dict for Python 3.7/3.8 compatibility (safe to remove once these versions are no longer supported)
9+
if TYPE_CHECKING:
10+
from collections.abc import Mapping
11+
else:
12+
Mapping = Dict
813

914

1015
class Clock:

0 commit comments

Comments
 (0)