-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On Python 3.11 pydantic's use of dataclass_transform is incorrect #4500
Comments
Thanks so much, will fix. |
will be fixed in #4501. |
ops, cherry-picking to main closed this. |
@samuelcolvin, thanks for the quick fix! Currently there are relatively few pydantic + pyright users who are on Python 3.11, but that number will increase as 3.11 approaches release. I could put some temporary special-case hackery in place within pyright to work around this issue, but I'd prefer not to do this if it can be helped. It looks like you release new versions of pydantic pretty frequently (ever week or so). I think it's therefore safe to just wait for your next release and tell developers to upgrade to it. Let me know if you have concerns with that plan. |
A patch release for v1.10 (the first pydantic version which supports 3.11) will be out in the next few days I would guess, so no need. I've also fixed it on main, so it'll be correct in v2. |
thanks for letting me know about this, on this occasion the fix was very simple. |
closed via #4501 |
hey @samuelcolvin – as far as I can see v1.10.2 was released on September 5 without #4501 (which was merged on September 7) do you think it would be possible to release a new patch release with this fix? it's been a few months now, and I'm hitting this error when working on https://github.com/RobertCraigie/prisma-client-py/ it's not the end of the world, as in this particular case the need for |
Thanks for asking, best to comment on #4552, I'll try to get something out next week. |
thank you so much @samuelcolvin :) (also for the original fix!) |
Would that include #4568? |
Yes, but "next week" has become a whirl wind. This is very much on my conscience, but we're probably looking at next week (again). So sorry. |
Your efforts are highly appreciated. |
Initial Checks
Description
Pydantic uses PEP 681's
dataclass_transform
for compatibility with static type checkers. One of the features described in PEP 681 is the ability to describe a set of custom "field specifier" classes. In an early version of PEP 681, these were specified using a parameter namedfield_descriptors
, but based on feedback the parameter name was changed tofield_specifiers
for the final version of the PEP. Pydantic is still using the (now obsolete) parameter name.See microsoft/pyright#3912 for details.
Example Code
No response
Python, Pydantic & OS Version
Affected Components
.dict()
and.json()
construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: