Skip to content

Improve fmt:skip handling in nested expressions with checks#4903

Merged
cobaltt7 merged 2 commits into
psf:mainfrom
Nikhil172913832:fixing_issue_4730
May 11, 2026
Merged

Improve fmt:skip handling in nested expressions with checks#4903
cobaltt7 merged 2 commits into
psf:mainfrom
Nikhil172913832:fixing_issue_4730

Conversation

@Nikhil172913832
Copy link
Copy Markdown
Contributor

Description

Closes #4730

This PR addresses issue #4730, where # fmt: skip was being ignored or causing crashes in deeply nested expressions. The root cause is that Black's handling of fmt: skip converts AST nodes to string literals, which bypasses bracket tracking and can result in missing attributes like bracket_depth. This led to AttributeError exceptions, especially with extreme settings like --line-length=1.

Key changes:

  • Added hasattr(leaf, "bracket_depth") checks in src/black/lines.py to prevent crashes when processing leaves generated by fmt: skip.
  • Added a test (tests/data/cases/fmtskip_nested_expression.py) using the original code from the issue, without relying on the --no-preview-line-length-1 flag, as requested by maintainers.
  • Updated CHANGES.md to document the fix.

Checklist - did you ...

  • Implement any code style changes under the --preview style, following the
    stability policy?
  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@Nikhil172913832 Nikhil172913832 force-pushed the fixing_issue_4730 branch 2 times, most recently from 5a24ecc to 9832386 Compare December 10, 2025 16:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 10, 2025

diff-shades results comparing this PR (daf3681) to main (6b5f6ab):

--preview style: no changes

--stable style: no changes


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

@Nikhil172913832
Copy link
Copy Markdown
Contributor Author

Hi @cobaltt7, can you have a look at this PR when you get time.

Comment on lines +33 to +34
and 1
in ( # fmt: skip
Copy link
Copy Markdown
Collaborator

@cobaltt7 cobaltt7 Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line shouldn't be formatted due to the fmt:skip (that's the bug in the original issue)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will look into it

Copy link
Copy Markdown

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasattr(leaf, bracket_depth) in is_line_short_enough avoids fmt:skip nested in (...) blowing up; fmtskip_nested_expression.py covers the formatter. nit: getattr(leaf, bracket_depth, None) might read clearer than continue/pass around comma tracking if you revisit this.

@cobaltt7
Copy link
Copy Markdown
Collaborator

Hey @Nikhil172913832, are you still working on this PR?

@Nikhil172913832
Copy link
Copy Markdown
Contributor Author

@cobaltt7 , I’ve tried a few different approaches, but haven’t been able to get it working yet. It likely needs a deeper fix. I’ll continue investigating, but I’m open to any suggestions if you have ideas.

@Nikhil172913832 Nikhil172913832 force-pushed the fixing_issue_4730 branch 2 times, most recently from 44cd9a8 to e43cf9f Compare April 23, 2026 07:08
@Nikhil172913832
Copy link
Copy Markdown
Contributor Author

Hi @cobaltt7 , can you please review the pr.

@cobaltt7
Copy link
Copy Markdown
Collaborator

Thanks!

@cobaltt7 cobaltt7 merged commit aef52e0 into psf:main May 11, 2026
52 checks passed
luketainton pushed a commit to luketainton/repos_webexmemebot that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/webexmemebot/pulls/585
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_PwnedPW that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJsaW50aW5nIl19-->

Reviewed-on: https://git.tainton.uk/repos/PwnedPW/pulls/334
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_epage that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/epage/pulls/220
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/luke_instant-msg-api that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/luke/instant-msg-api/pulls/258
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_pypilot that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/446
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_roboluke that referenced this pull request May 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<26.3.2,>=26.3.1` → `<26.5.1,>=26.5.0` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/black/26.5.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/26.3.1/26.5.0?slim=true) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v26.5.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#Version-2650)

[Compare Source](psf/black@26.3.1...26.5.0)

##### Highlights

- Add support for unpacking in comprehensions (PEP 798) and for lazy imports (PEP 810),
  both new syntactic features in Python 3.15 ([#&#8203;5048](psf/black#5048))
- Python 3.15 is now supported. Compiled wheels are not yet provided for Python 3.15, so
  performance may be slower than on existing Python versions. Wheels will be provided
  once Python 3.15 is later in its release cycle. ([#&#8203;5127](psf/black#5127))

##### Stable style

- Fix `# fmt: skip` being ignored in nested `if` expressions with parenthesized `in`
  clauses ([#&#8203;4903](psf/black#4903))
- Add syntactic support for Python 3.15 ([#&#8203;5048](psf/black#5048))
- Fix crash when an f-string follows a `# fmt: off` comment inside brackets ([#&#8203;5097](psf/black#5097))
- Preserve multiline compound statement headers when `# fmt: skip` is placed on the
  colon line ([#&#8203;5117](psf/black#5117))

##### Preview style

- Improve heuristics around whether blank lines should appear before, within and after
  groups of same-name decorated functions (such as `@overload` groups) in `.pyi` stub
  files ([#&#8203;5021](psf/black#5021))
- Fix blank lines being removed between a function and a decorated class in `.pyi` stub
  files ([#&#8203;5092](psf/black#5092))
- Prevent string merger from creating unsplittable long lines when a pragma comment
  (e.g. `# type: ignore`) follows the closing bracket ([#&#8203;5096](psf/black#5096))

##### Packaging

- Run CI on 3.15 ([#&#8203;5127](psf/black#5127))

##### Output

- Improve parse error readability by showing multi-line output with an error pointer.
  ([#&#8203;5068](psf/black#5068))
- Add `SourceASTParseError` to distinguish source parse failures from internal safety
  errors, improving error reporting when Black's lenient parser accepts input that
  `ast.parse()` rejects ([#&#8203;5080](psf/black#5080))

##### *Blackd*

- Return HTTP 400 (Bad Request) for source parse failures instead of HTTP 500, keeping
  HTTP 500 only for genuine internal safety errors ([#&#8203;5080](psf/black#5080))

##### Integrations

- Added documentation for doctest formatting tools and updated the integrations index to
  match ([#&#8203;4916](psf/black#4916))

##### Documentation

- Use "Version X.Y.Z" headings in changelog for stable permalink anchors on ReadTheDocs
  ([#&#8203;5063](psf/black#5063))
- Note in the editor integrations that the SublimeText `sublack` plugin is archived and
  unmaintained ([#&#8203;5082](psf/black#5082))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODEuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4MS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/roboluke/pulls/448
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
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.

# fmt: skip ignored inside multi-part if-clause

3 participants