Skip to content

Warn on ExceptionGroup subclasses without a .derive() method#448

Merged
Zac-HD merged 4 commits intopython-trio:mainfrom
Zac-HD:claude/fix-flake8-async-334-opeLM
Apr 22, 2026
Merged

Warn on ExceptionGroup subclasses without a .derive() method#448
Zac-HD merged 4 commits intopython-trio:mainfrom
Zac-HD:claude/fix-flake8-async-334-opeLM

Conversation

@Zac-HD
Copy link
Copy Markdown
Member

@Zac-HD Zac-HD commented Apr 22, 2026

Warn when a class inherits from ExceptionGroup / BaseExceptionGroup but doesn't override derive. Without that override, split/subgroup (as used by nursery and TaskGroup implementations) silently produce plain ExceptionGroup instances instead of the custom subclass. Fixes #334.

Also fixes #446.

Warn when a class inherits from `ExceptionGroup` / `BaseExceptionGroup`
but doesn't override `derive`. Without that override, `split`/`subgroup`
(as used by nursery and TaskGroup implementations) silently produce
plain `ExceptionGroup` instances instead of the custom subclass.

Fixes python-trio#334.
@Zac-HD Zac-HD force-pushed the claude/fix-flake8-async-334-opeLM branch from 28ab3a8 to 574638f Compare April 22, 2026 18:16
pre-commit-ci Bot and others added 3 commits April 22, 2026 18:20
`trio.aclose_forcefully` (and `anyio.aclose_forcefully`) are designed
specifically for cleanup and cancel immediately by design, so calling
them in a `finally:` / critical `except:` does not introduce the
cancellation-replacing hazard that ASYNC102 targets. Treat them as safe,
same as `.aclose()` with no arguments.

Fixes python-trio#446.
The pre-commit ruff/black formatter wrapped some `class Foo(Bar):` lines
across multiple lines, which moved the trailing `# error:` annotation off
the line where the visitor actually emits the error (the `class` keyword
line). Use shorter class names so the formatter leaves them on a single
line.
@Zac-HD Zac-HD merged commit 129f952 into python-trio:main Apr 22, 2026
10 checks passed
@Zac-HD Zac-HD deleted the claude/fix-flake8-async-334-opeLM branch April 22, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASYNC102 should allow aclose_forcefully Warn on ExceptionGroup subclass without derive

2 participants