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

fix interaction between extra != 'ignore' and from_attributes=True #1275

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Apr 19, 2024

Change Summary

This is a bugfix to set the interaction between extra and from_attributes to match the pre-2.7 behaviour.

To be honest, I don't love it, basically if from_attributes is set then extra basically always functions as "ignore". I can sort of see why, and we didn't intend to change it in 2.7, but I wonder if there's more satisfying long-term behaviour.

Related issue number

Fixes pydantic/pydantic#9242
Fixes pydantic/pydantic#9250

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @samuelcolvin

@davidhewitt
Copy link
Contributor Author

please review

Copy link

codspeed-hq bot commented Apr 19, 2024

CodSpeed Performance Report

Merging #1275 will degrade performances by 14.14%

Comparing dh/extra-from-attributes (c150587) with main (91c3541)

Summary

❌ 1 (👁 1) regressions
✅ 154 untouched benchmarks

Benchmarks breakdown

Benchmark main dh/extra-from-attributes Change
👁 test_strict_union_error_core 53.7 µs 62.6 µs -14.14%

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for looking into this!

@sydney-runkle sydney-runkle merged commit 3240277 into main Apr 22, 2024
28 checks passed
@sydney-runkle sydney-runkle deleted the dh/extra-from-attributes branch April 22, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PanicException: Python API call failed Nested class in input considered a parameter in 2.7?
3 participants