Skip to content

Avoid leaking decoration state in remove_format - #529

Open
ShipItAndPray wants to merge 1 commit into
python-poetry:mainfrom
ShipItAndPray:fix-423-local-decoration-suppression
Open

ShipItAndPray wants to merge 1 commit into
python-poetry:mainfrom
ShipItAndPray:fix-423-local-decoration-suppression

Conversation

@ShipItAndPray

Copy link
Copy Markdown

Summary

  • stop Formatter.remove_format() from mutating the shared _decorated flag while stripping styles
  • use an operation-local suppression flag so decoration stays disabled only for that formatting call
  • add a deterministic threaded regression covering shared formatter use between a StreamOutput and SectionOutput

Scope

This fixes the leaked undecorated state described in #423. It does not claim to make the formatter generally thread-safe.

Testing

  • .venv/bin/pytest tests/io/outputs/test_section_output.py -k shared_decoration_state -q
  • .venv/bin/pytest tests/formatters/test_formatter.py tests/io/outputs/test_section_output.py -q

Closes #423.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter's is_decorated property is temporarily disabled during remove_format breaking concurrent threads

2 participants