Repository navigation
Only mark model as complete once all fields are complete - #11759
Conversation
|
Hmm, we're good on Python 3.11+, but failing on earlier versions... The issue appears to be that inside This causes Pydantic to leave the pydantic/pydantic/_internal/_fields.py Lines 211 to 213 in 625dd42 Pydantic behaves correctly because Interestingly, pydantic/pydantic/_internal/_typing_extra.py Lines 274 to 289 in 625dd42 For this PR, I'll change it from @Viicos What do you think? |
CodSpeed Performance ReportMerging #11759 will not alter performanceComparing Summary
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
@Viicos Please review! |
This is a bug that was fixed in python/cpython#30900. iirc, this unfortunately can't be backported to
I think we can live with the inconsistency here. The primary goal of |
0c9ec0f to
dd5f919
Compare
|
@Viicos Back to you! |
|
The failing Pandera test is already being fixed in #11767. |
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
03eebf1 to
ed18a83
Compare
Change Summary
BaseModel.model_rebuildalready ensured that__pydantic_fields_complete__wasTruebefore marking the model as complete, including rebuilding model fields to 1) see if any unknown annotations could not be resolved, and 2) if not, to make sure that the mock error message includes the name of the unknown annotation.We now do the same on
ModelMetaclass.__new__, to make sure that subclasses of incomplete superclasses don't incorrectly get marked as complete.Here is such an example:
Related issue number
Preparation for #11453
Edit: fixes #12061.
Checklist
Selected Reviewer: @sydney-runkle