Skip to content

Handle pprint formatting on Python 3.15 - #14919

Open
ayxsh1130 wants to merge 3 commits into
pytest-dev:mainfrom
ayxsh1130:fix-pformat-expand
Open

Handle pprint formatting on Python 3.15#14919
ayxsh1130 wants to merge 3 commits into
pytest-dev:mainfrom
ayxsh1130:fix-pformat-expand

Conversation

@ayxsh1130

Copy link
Copy Markdown

Handle pprint.pformat() formatting on Python 3.15.

Python 3.15 adds the expand parameter to pprint.pformat(). This change adds a compatibility wrapper in _pytest.compat that enables expand=True on Python 3.15 while preserving the existing behavior on older Python versions.

The internal pformat usages are routed through this compatibility wrapper, and a regression test verifies the expected behavior.

Closes #14859

Tests:

  • python -m pytest testing/test_compat.py -q
  • Full pre-commit checks pass.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use expand=True for pformat(...) in python 3.15+

1 participant