Skip to content
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

support kwargs with from_attributes #223

Closed
samuelcolvin opened this issue Aug 5, 2022 · 2 comments
Closed

support kwargs with from_attributes #223

samuelcolvin opened this issue Aug 5, 2022 · 2 comments
Labels
good first issue Good for newcomers

Comments

@samuelcolvin
Copy link
Member

samuelcolvin commented Aug 5, 2022

As per pydantic/pydantic#3375 we should support kwargs with from_attributes.

To do this, effectively

https://github.com/samuelcolvin/pydantic-core/blob/fdf42b8b0d0684bc2cac04d34c40fe4b0d33498d/src/input/return_enums.rs#L158

Becomes

PyGetAttr(&'a PyAny, Option<&'a PyDict>),

The dict "wins" over the object if it is some.

Then py_get_attr calls py_get_item first if the option is Some.

@samuelcolvin
Copy link
Member Author

I guess the input validator needs to support a tuple of (object, kwargs) too.

@samuelcolvin
Copy link
Member Author

fixed in #306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant