Skip to content

Commit

Permalink
fix(typing): Use safer typing_extensions.runtime_checkable unless `…
Browse files Browse the repository at this point in the history
…python>=3.12.0`

Any objects using `__getattr__`, e.g. `Parameter` break on older versions [see PR](python/cpython#103034)
  • Loading branch information
dangotbanned committed May 31, 2024
1 parent 1ad06f4 commit 61279cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
Sequence,
Type,
cast,
Literal,
TYPE_CHECKING,
)
from types import ModuleType

Expand All @@ -32,12 +34,15 @@
from altair.utils.schemapi import SchemaBase
from altair.utils._dfi_types import Column, DtypeKind, DataFrame as DfiDataFrame

if sys.version_info >= (3, 12):
from typing import runtime_checkable, Protocol
else:
from typing_extensions import runtime_checkable, Protocol
if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import ParamSpec

from typing import Literal, Protocol, TYPE_CHECKING, runtime_checkable

if TYPE_CHECKING:
from pandas.core.interchange.dataframe_protocol import Column as PandasColumn
Expand Down

0 comments on commit 61279cd

Please sign in to comment.