Skip to content

Fix crash on async def/with/for with semicolon and fmt: skip (#5307) - #5308

Closed
Dharshika-11 wants to merge 3 commits into
psf:mainfrom
Dharshika-11:fix-async-fmt-skip-5307
Closed

Dharshika-11 wants to merge 3 commits into
psf:mainfrom
Dharshika-11:fix-async-fmt-skip-5307

Conversation

@Dharshika-11

Copy link
Copy Markdown
Contributor

Summary

Fixes #5307.

Black crashes when # fmt: skip is used with one-line async def and async with statements containing a semicolon.

For example:

async with give_me_async_context(): print("a");  # fmt: skip
async def give_me_async_context(): print("a");  # fmt: skip

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

diff-shades results comparing this PR (5b20bc8) to main (74371e2):

--preview style: no changes

--stable style: no changes


What is this? | Workflow run | diff-shades documentation

@cobaltt7

Copy link
Copy Markdown
Collaborator

Please add a changelog entry and format Black with itself

@Dharshika-11

Copy link
Copy Markdown
Contributor Author

@cobaltt7 Thanks for the feedback! I'll add the changelog entry and format Black with itself, then I'll push the updates to the PR.

cobaltt7 pushed a commit to sahvx655-wq/black that referenced this pull request Aug 19, 2026
@cobaltt7

Copy link
Copy Markdown
Collaborator

Thanks! Sorry, but I ended up going with #5311 due to the more concise and targeted fix.

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.

Crash on async def/with and a semicolon on the same line

2 participants