Fix reference leak when defining a Struct type - #1194
Merged
Merged
Conversation
provinzkraut
previously approved these changes
Sep 20, 2026
Contributor
Author
|
Sorry, my push dropped your approval. The fix itself is unchanged; the extra commit only touches tests. Both original tests went through borrowed Could you take another look when you have a moment? |
4 tasks done
pull Bot
pushed a commit
to Mu-L/msgspec
that referenced
this pull request
Sep 29, 2026
Entries for msgspec#1194, msgspec#1196, msgspec#1197, msgspec#1199 and msgspec#1209 are missing from the changelog of the 0.22.0 release. Of the changes merged after msgspec#1211 moved the unreleased entries into the 0.22.0 section, only msgspec#1207 added its own entry. This adds the missing entries next to the related entries in that section, and marks msgspec#1196 as a breaking change: objects that expose `__dataclass_fields__` only through instance attribute access are no longer encoded as dataclasses. Co-authored-by: Tseluiko Aleksandr <4410812+Siyet@users.noreply.github.com>
This branch was successfully 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.
structmeta_collect_fieldsownsannotations, and alsomodule_nswhen a stringClassVarannotation is present. Both were released only on the failure paths, so every successful struct class definition that carries annotations retained its annotations dict, and a class carrying a stringClassVarannotation additionally retained the namespace of its module.Release both on the success path. The regression tests use weakrefs rather than reference counts, so they are meaningful on free-threaded builds as well.
Fixes #1193.