pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.42k stars 239 forks source link

Rust stacktraces and panics with validate_assignment and custom fields #1516

Open devkral opened 1 day ago

devkral commented 1 day ago

Environment:

In the edgy project we customize the fields and models heavily. We inherit from FieldInfo and provide our own information.

Bug:

When turning on validate_assignment suddenly rust stack traces appear for some tests. In particular when we modify the fields so they aren't required anymore for the copy.

How to reproduce:

Run the test suite of:

https://github.com/dymmond/edgy/tree/devkral/potential_pydantic_bugs

with hatch test

It seemingly happens when assigning an attribute.

devkral commented 19 hours ago

I don't get a traceback but could extract this: thread '' panicked at src/validators/model_fields.rs:422:85: