-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
Description
It looks like something is fundamentally broken in how Struct subclasses find their fields under 3.14b1. This was observed on Arm Mac with the latest release, and Linux with latest release as well as main.
Working, on 3.13:
[tim@tangerine ~]$ uvx --from='git+https://github.com/jcrist/msgspec@main' python
Built msgspec @ git+https://github.com/jcrist/msgspec@bc60e96772c5e8a3babff967d86a9e7dfcdbfb1b
Installed 1 package in 1ms
Python 3.13.2 (main, Feb 12 2025, 14:51:17) [Clang 19.1.6 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from msgspec import Struct
>>> class S(Struct):
... rule_name: str
...
>>> S("foo")
S(rule_name='foo')
>>> S()
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
S()
~^^
TypeError: Missing required argument 'rule_name'
Broken, on 3.14:
[tim@tangerine ~]$ uvx -p 3.14 --from='git+https://github.com/jcrist/msgspec@main' python
Installed 1 package in 3ms
Python 3.14.0b1 (main, May 14 2025, 15:26:05) [GCC 15.1.1 20250425] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from msgspec import Struct
>>> class S(Struct):
... rule_name: str
...
>>> S("foo")
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
S("foo")
~^^^^^^^
TypeError: Extra positional arguments provided
>>> S()
S()
cc @nedbat
return42, EthanC, johan-octonomy, emaxx-google and kamikaze
Metadata
Metadata
Assignees
Labels
No labels