Skip to content

Commit 35de477

Browse files
committed
Update to attrs 25.4
1 parent 28c1154 commit 35de477

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ authors = [
4040
{name = "Tin Tvrtkovic", email = "tinchester@gmail.com"},
4141
]
4242
dependencies = [
43-
"attrs>=24.3.0",
43+
"attrs>=25.4.0",
4444
"typing-extensions>=4.14.0",
4545
"exceptiongroup>=1.1.1; python_version < '3.11'",
4646
]

src/cattrs/subclasses.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ def subclasses(cls: type) -> list[type]:
1111
def subclasses(cls: type) -> list[type]:
1212
"""A helper for getting subclasses of a class.
1313
14-
Filters out duplicate subclasses of slot dataclasses.
14+
Filters out duplicate subclasses of slot dataclasses and attrs classes.
1515
"""
1616
return [
1717
cl
1818
for cl in cls.__subclasses__()
19-
if not (
20-
"__slots__" not in cl.__dict__
21-
and hasattr(cls, "__dataclass_params__")
22-
and cls.__dataclass_params__.slots
19+
if (
20+
not (
21+
"__slots__" not in cl.__dict__
22+
and hasattr(cls, "__dataclass_params__")
23+
and cls.__dataclass_params__.slots
24+
)
25+
and not hasattr(cls, "__attrs_base_of_slotted__")
2326
)
2427
]

tests/typed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def _create_hyp_class_and_strat(
287287
attrs_and_strategy: list[tuple[_CountingAttr, SearchStrategy[PosArg]]],
288288
) -> SearchStrategy[tuple[type, SearchStrategy[PosArgs], SearchStrategy[KwArgs]]]:
289289
def key(t):
290-
return (t[0].default is not NOTHING, t[0].kw_only)
290+
return (t[0].default is not NOTHING, t[0].kw_only or False)
291291

292292
attrs_and_strat = sorted(attrs_and_strategy, key=key)
293293
attrs = [a[0] for a in attrs_and_strat]

tests/untyped.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _create_hyp_class(
177177
"""
178178

179179
def key(t):
180-
return (t[0].default is not NOTHING, t[0].kw_only)
180+
return (t[0].default is not NOTHING, t[0].kw_only or False)
181181

182182
attrs_and_strat = sorted(attrs_and_strategy, key=key)
183183
attrs = [a[0] for a in attrs_and_strat]

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)