Skip to content

Commit eec7e80

Browse files
authored
Merge pull request #6034 from davidfokkema/fix-selecttype-hashable
SelectType must be Hashable
2 parents 3a3d046 + 61ff929 commit eec7e80

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
# [Unreleased]
9+
10+
### Fixed
11+
12+
- Fix type hint for SelectType: only hashable types are allowed.
13+
814
# [5.3.0] - 2025-08-07
915

1016
### Added

src/textual/widgets/_select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass
4-
from typing import TYPE_CHECKING, Generic, Iterable, TypeVar, Union
4+
from typing import TYPE_CHECKING, Generic, Hashable, Iterable, TypeVar, Union
55

66
import rich.repr
77
from rich.console import RenderableType
@@ -261,7 +261,7 @@ def _on_click(self, event: events.Click) -> None:
261261
self.post_message(self.Toggle())
262262

263263

264-
SelectType = TypeVar("SelectType")
264+
SelectType = TypeVar("SelectType", bound=Hashable)
265265
"""The type used for data in the Select."""
266266
SelectOption: TypeAlias = "tuple[str, SelectType]"
267267
"""The type used for options in the Select."""

0 commit comments

Comments
 (0)