-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
StringIO breaking change for str subclasses #149046
Copy link
Copy link
Open
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-IOtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-IOtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
This is, in a way, a follow-up from #148241.
This other PR fixed a breaking change in behaviour where classes inheriting
strwould have__str__called on them when instead of using the "underlying"stritself. The PR fixed the problem for JSON serialisation, but seemingly missed some other call sites, includingStringIO. This seems to affect Python 3.14+ (but works as expected on 3.13).This is a reproducer and this is a fix PR: #149047.
... gives
AssertionError: got 'WRONG_VALUE'on 3.14 and a locally built 3.15/dev.CPython versions tested on:
3.14
Operating systems tested on:
macOS
Linked PRs
StringIO#149047