# What changed in black

> 68 changes in black 26 from its official release notes, upgrade guides and advisories: 7 breaking, 2 security, 6 new APIs and options. Each one cited. Sources checked 2026-10-18. HTML: https://unstale.sh/pypi/black/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## black 26

### Breaking changes

- The bundled action now rejects URL references and other non-released-version values read from tool.black.required-version, addressing a security issue. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Repeated lines outside the selected ranges are left unchanged. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Preview style parenthesizes expressions with parameter comments when they exceed the line length. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- In preview style, short expressions inside brackets are not split on delimiters when preceded by a standalone comment. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Rejects non-string `force-exclude` values in `pyproject.toml`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Rejects non-string `include` values in `pyproject.toml`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- T-strings in docstring position are no longer treated as docstrings. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)

### Security

- Black: Arbitrary file writes from unsanitized user input in cache file name (26.3.1) — [security advisory](https://github.com/advisories/GHSA-3936-CMFR-PM3M)
- Black is the uncompromising Python code formatter. Black provides a GitHub action for formatting code. This action supports an option, use_pyproject: true, for reading the version of Black to use from the repository pyproject.toml. A malicious pull request could edit (26.3.0) — [security advisory](https://github.com/advisories/GHSA-V53H-F6M7-XCGM)

### New APIs and options

- Adds a command-line option to configure the cache directory. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- GitHub Action runs expose the `is_formatted`, `change_count`, `same_count`, and `failure_count` outputs. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- GitHub Action runs expose the `is_formatted`, `change_count`, `same_count`, and `failure_count` outputs. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- GitHub Action runs expose the `is_formatted`, `change_count`, `same_count`, and `failure_count` outputs. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- GitHub Action runs expose the `is_formatted`, `change_count`, `same_count`, and `failure_count` outputs. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- The environment variable disables ANSI output. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)

### Performance

- Avoids quadratic runtime when splitting very long lines with many trailing bracket pairs. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Fixes superlinear runtime growth as the number of input files increases. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Improves performance on long calls and collections, soft keywords, semicolon-separated statements, deeply nested expressions, and compound statements with many clauses. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Improves performance on files with many sibling blocks. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Release binaries are smaller because debug symbols are stripped during the PyInstaller release build. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Improves performance on strings with many consecutive backslashes, multiline strings in large collections, and several string-processing operations. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)

### Behavior and default changes

- Preview style avoids unnecessary parentheses around unbreakable right-hand-side expressions, including in annotated assignments and subscript targets. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Validates line-range values. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preview style enforces a blank line after a function or method with a docstring-only body when another comment or statement follows. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Unstable style splits long stringified return annotations even when the function has parameters. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- The GitHub Action supports PEP 440 version specifiers for `tool.black.required-version`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)

### Tooling

- Keeps parentheses around a lambda used as the iterable of a comprehension. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Reports parser failures using editor-friendly `path:line:column` locations. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preview style normalizes uppercase `T` prefixes to lowercase. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preview style parenthesizes tuple expressions for consistency with function calls and returns. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)

### Fixes and other changes

- Black no longer moves an encoding declaration onto the first two lines of a file. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Fixes the action crashing on dependency-group includes when `use_pyproject` is enabled. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Black respects `.gitignore` files that start with a UTF-8 byte order mark, so the first pattern matches and ignored files are not formatted. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Long notebook assignment magics such as `x = !ls -la` are left unchanged instead of being wrapped in parentheses that IPython can no longer run. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Formatting now handles lines following a statement when that statement is joined or re-indented. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Formatting no longer crashes when an unselected statement has a `# fmt: skip` comment before a closing bracket. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Files formatted or checked with selected line ranges are no longer cached as formatted, preventing later full checks from passing or skipping unformatted lines. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Black no longer adds an extra trailing blank line inside a multi-line module docstring when its last line is near the line length limit. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- The unstable feature no longer removes backslash-newline sequences from raw strings and changes their value. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- The unstable feature no longer adds a space after `*` or `**` in a PEP 695 type parameter when splitting a string in its default. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Preview style avoids unnecessary line splits of trailers when an earlier bracket split exceeds the line length only because of a trailing comment. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- The feature no longer drops parentheses around a right-hand side containing a dictionary and leaves the line over the length limit. (26.10.1) — [release notes](https://github.com/psf/black/releases/tag/26.10.1)
- Keeps parentheses around annotated-assignment targets, preserving their effect on `__annotations__`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Invalid worker values are reported as usage errors instead of causing a crash. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes crashes on standalone comments between tokens and preserves inline comments on brackets inside comprehensions. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- When sources share no common project root, Black falls back to the default configuration with a warning instead of crashing. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes multiline indentation with leading tabs and prevents form feeds or similar characters from becoming newlines. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preserves blank lines immediately before a `# fmt: on` comment. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes formatting and crashes involving skipped bracketed expressions, PEP 695 declarations, headers, comments, and one-line statements. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Correctly excludes files whose paths contain `..` when invoked from a subdirectory. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Stops converting form feeds and similar characters in docstrings into newlines. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preview style removes redundant parentheses around generator expressions. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes misplaced or dropped inline comments around optional parentheses, comprehensions, and bracketed expressions. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes parsing assignment magics when non-ASCII characters occur earlier on the line. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- No longer inserts an empty line after a docstring when the range covers only the docstring, and preserves comments and blank lines outside requested ranges. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Respects the magic trailing comma in PEP 695 type parameter lists containing a `*TypeVarTuple` or `**ParamSpec`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes crashes when splitting `case case if ...` patterns at very small line lengths. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Stops dropping trailing commas from split single-element tuple lambda defaults and one-element subscripts. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preserves CRLF endings on the skipped line instead of turning them into `\r\r\n`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Avoids a crash when writing formatted code or diffs to a stdout without a `buffer` attribute. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes unparseable output when a t-string replacement field contains a quote. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- No longer emits a spurious warning when the runtime version is included in the flag. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes unparseable output when the string body ends in an already-escaped double quote. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Preview style removes redundant parentheses around individual variables in unpacking targets. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Blackd returns HTTP 400 for an empty header or empty entry, and accepts optional whitespace around comma-separated versions and `pyi`. (26.10.0) — [release notes](https://github.com/psf/black/releases/tag/26.10.0)
- Fixes unstable formatting when a subscript annotation contains an inline comment. (26.5.1) — [release notes](https://github.com/psf/black/releases/tag/26.5.1)
- Corrects the version reported by published executables. (26.5.1) — [release notes](https://github.com/psf/black/releases/tag/26.5.1)
- Preserves inline comments immediately before a `# fmt: skip` line, avoiding AST equivalence failures. (26.5.1) — [release notes](https://github.com/psf/black/releases/tag/26.5.1)
