Fixed an issue decoding Dataclass and TypedDict instances - #1126
Open
mishmish66 wants to merge 1 commit into
Open
Fixed an issue decoding Dataclass and TypedDict instances#1126mishmish66 wants to merge 1 commit into
Dataclass and TypedDict instances#1126mishmish66 wants to merge 1 commit into
Conversation
… unicode fields wouldn't decode properly since the nocheck path was run without cached unicode values.
mishmish66
had a problem deploying
to
docs-preview
July 19, 2026 04:23 — with
GitHub Actions
Failure
Member
There was a problem hiding this comment.
Mhm. I'm not sure if this is the best way to fix the issue. Invoking PyUnicode_AsUTF8 purely for its side effect doesn't seem to great. We're not doing this elsewhere for UTF8 either, so I would suggest not introducing this pattern for this particular path only.
Have you checked if other types (Struct, NamedTuple, attrs classes) are also affected? If not, dataclasses / TypedDicts should handle this the same way these do.
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.
To reproduce try this snippet (in a fresh process):
Can't decode π because it is unicode and hasn't been loaded into the unicode cache yet
But this:
works fine since the cache is populated during encoding.
This PR should have a fix for this and also a test that fails the old unfixed version.