Skip to content

Fix crash when TypedDict contains incorrect metadata#853

Merged
ofek merged 2 commits intojcrist:mainfrom
JelleZijlstra:fix-broken-typeddict
Oct 20, 2025
Merged

Fix crash when TypedDict contains incorrect metadata#853
ofek merged 2 commits intojcrist:mainfrom
JelleZijlstra:fix-broken-typeddict

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Contributor

Fixes at least some of the failures reported in:
#852 (comment)

These were exposed by a bug in 3.14b1 where TypedDict reported
incorrect __annotations__ but correct __required_keys__. msgspec
would crash in this case. The bug is reproducible on earlier Python
versions by manually manipulating attributes on a TypedDict class.

It's a pretty marginal bug but I would argue the extension should
be robust to this sort of edge case.

Fixes at least some of the failures reported in:
jcrist#852 (comment)

These were exposed by a bug in 3.14b1 where TypedDict reported
incorrect `__annotations__` but correct `__required_keys__`. msgspec
would crash in this case. The bug is reproducible on earlier Python
versions by manually manipulating attributes on a TypedDict class.

It's a pretty marginal bug but I would argue the extension should
be robust to this sort of edge case.
Comment thread tests/test_common.py Outdated
Copy link
Copy Markdown
Collaborator

@ofek ofek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ofek ofek merged commit 0f347bf into jcrist:main Oct 20, 2025
@JelleZijlstra JelleZijlstra deleted the fix-broken-typeddict branch October 20, 2025 03:47
manzt pushed a commit to marimo-team/msgspec that referenced this pull request Nov 14, 2025
manzt added a commit to marimo-team/msgspec that referenced this pull request Nov 14, 2025
* Fix crash when TypedDict contains incorrect metadata (jcrist#853)

* Fix annotations support on 3.14 (jcrist#852)

* Relax all getrefcount tests to allow lower numbers (jcrist#854)

* Add 3.14 to CI (jcrist#888)

* add free-threading support  (jcrist#877)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Enable Python 3.14 tests in CI

Remove cp314-* from CIBW_TEST_SKIP to allow Python 3.14 tests to run.
Previously, 3.14 wheels were built but tests were skipped.

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants