Skip to content

fix: keep tab-width compensation local to each docstring - #409

Merged
weibullguy merged 1 commit into
PyCQA:masterfrom
Dodothereal:fix-tab-width-compensation-20261101
Nov 2, 2026
Merged

weibullguy merged 1 commit into
PyCQA:masterfrom
Dodothereal:fix-tab-width-compensation-20261101

Conversation

@Dodothereal

Copy link
Copy Markdown
Contributor

Summary

Tab-width compensation currently subtracts from the shared wrap_summaries and wrap_descriptions options. Each tab-indented docstring shrinks the widths available to later docstrings and files. With --tab-width 4 --wrap-summaries 40 --wrap-descriptions 40, thirteen identical function docstrings can even split the quote delimiters and produce invalid Python.

Calculate the adjusted widths locally instead. The regression tests cover repeated docstrings and files, tab widths 4/8, preserved indentation, disabled wrapping, valid Python, and idempotence.

Validation

Read-only native-cloud validation on Python 3.12.14:

  • New regressions: 24 failures before the fix, 24 passes after.
  • Available pytest subset: 658 passed, 3 skipped, 82 deselected. The unchanged baseline subset had 634 passed and the same skips/deselections.
  • 192 stdin CLI cases passed, including LF/CRLF and zero-width combinations.
  • Black 26.3.1, Ruff 0.15.11, and the repository-pinned docformatter hook passed.

The 82 filesystem-dependent tests, full tox/pre-commit runs, and other interpreters were not run under the read-only/disk-full constraint. isort, mypy, and pydocstyle were unavailable. This is not a full-suite pass.

Prepared with OpenAI Codex assistance.

@weibullguy
weibullguy merged commit 1b639ee into PyCQA:master Nov 2, 2026
7 checks passed
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.

2 participants