File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Changed
11+
12+ - Removed dependency on ` sentinel-value ` .
13+
1014## [ 5.4.2] - 2025-11-28
1115
1216### Removed
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ requires-python = ">=3.10"
2121dependencies = [
2222 " attrs >=23.1.0" ,
2323 " cattrs >=23.1.2" ,
24- " sentinel-value >=1.0.0" ,
2524 " typing-extensions >=4.13.1" ,
2625]
2726
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from typing import Final
65
7- from sentinel_value import sentinel
6+ class _IgnoreSetState (type ):
7+ def __setstate__ (cls , _state : object ) -> None :
8+ """Ignore setstate on outdated sentinel-value pickle data."""
89
9- IsA : Final = sentinel ("IsA" )
10- """The default is-a relationship tag used for entity inheritance."""
10+
11+ class IsA (metaclass = _IgnoreSetState ):
12+ """The default is-a relationship tag used for entity inheritance."""
13+
14+ def __new__ (cls : type [IsA ], * _args : object ) -> type [IsA ]: # type: ignore[misc]
15+ """Return own type instead of instance, for outdated sentinel-value pickle data."""
16+ return cls
17+
18+
19+ _sentinel_IsA = IsA # Compatibility with sentinel-value, deprecated since 5.4 # noqa: N816
Original file line number Diff line number Diff line change @@ -301,3 +301,10 @@ def test_type_form() -> None:
301301 world [None ].components [TupleKey ] = (1 , 2 )
302302 x , y = world [None ].components [TupleKey ]
303303 assert (x , y ) == (1 , 2 )
304+
305+
306+ PICKLED_ISA = b"\x80 \x03 ctcod.ecs.constants\n _sentinel_IsA\n q\x00 X\x12 \x00 \x00 \x00 tcod.ecs.constantsq\x01 X\x03 \x00 \x00 \x00 IsAq\x02 \x86 q\x03 \x81 q\x04 }q\x05 (X\r \x00 \x00 \x00 instance_nameq\x06 h\x02 X\x0b \x00 \x00 \x00 module_nameq\x07 h\x01 X\x0e \x00 \x00 \x00 qualified_nameq\x08 X\x16 \x00 \x00 \x00 tcod.ecs.constants.IsAq\t ub." # cspell: disable-line
307+
308+
309+ def test_unpickle_is_a () -> None :
310+ assert pickle .loads (PICKLED_ISA ) is tcod .ecs .IsA # noqa: S301
You can’t perform that action at this time.
0 commit comments