Repository navigation
Conversation
Improve defensive reading of _str_cache attribute in __str__ method.
Add test for NodeId string representation when cache is missing.
Ensure _str_cache attribute exists before deletion to maintain compatibility across interpreter versions.
|
Thanks for addressing this. Could a Pytest maintainer confirm if we can have the fix approved soon, or if Python 3.10.0 remains supported? Also, it might be beneficial to have some dedicated python 3.10.0 ci |
RonnyPfannschmidt
approved these changes
Nov 11, 2026
RonnyPfannschmidt
left a comment
Member
There was a problem hiding this comment.
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
Verified on CPython 3.10.0: main crashes, this branch runs. Fix is minimal and correct.
Generated by Claude Code
khuynh22
approved these changes
Nov 11, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15337.
On CPython 3.10.0, NodeId's cached-string attribute isn't initialized because of python/cpython#88815. Calling str() on it raises AttributeError and prevents pytest from starting.
This reads the cache with getattr and a None default, then lets the existing code rebuild it. Added a regression test that simulates the missing attribute, plus a changelog entry.
The relevant suites pass on Python 3.10.0 and 3.14. The regression test fails without the fix on 3.14, and a trivial suite that previously crashed now runs on 3.10.0.
AI assistance: this fix, regression test and PR description were prepared with Instinct.