Skip to content

Conversation

@Guest0x0
Copy link
Collaborator

Spawning on calling add_defer on an already terminated task group is an error. Previously this is handled via raising @async.AlreadyTerminated, but this is not the most appropriate solution. This kind of bad spawn are always programmer bug, with very clear pattern. So the most appropriate solution is to panic on bad spawn. This also allows removing the raise mark from the spawn functions, allowing them to be called in contexts that disallow error.

The AlreadyTerminated error become useless now, and is deprecated.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 702

Details

  • 2 of 4 (50.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 78.137%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/task_group.mbt 2 4 50.0%
Totals Coverage Status
Change from base Build 701: -0.05%
Covered Lines: 1183
Relevant Lines: 1514

💛 - Coveralls

@Guest0x0 Guest0x0 merged commit 42ab0bf into main Oct 31, 2025
10 checks passed
@Guest0x0 Guest0x0 deleted the panic-on-bad-spawn branch October 31, 2025 05:51
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.

3 participants