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

Handle __pydantic_extra__ annotation being a string or inherited #8659

Merged
merged 1 commit into from Jan 29, 2024

Conversation

alexmojaki
Copy link
Contributor

@alexmojaki alexmojaki commented Jan 29, 2024

Change Summary

Evaluates __pydantic_extra__ to an actual type when it's a string, e.g. because of from __future__ import annotations.

Also fixes another bug in that area: the loop for tp in (cls, *cls.__mro__): didn't use the variable tp so the annotation was not checked on parent classes.

Related issue number

Closes #8647

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@alexmojaki alexmojaki changed the title Handle __pydantic_extra__ annotation being a string or inherited Handle __pydantic_extra__ annotation being a string or inherited Jan 29, 2024
@alexmojaki alexmojaki added the relnotes-fix Used for bugfixes. label Jan 29, 2024
Copy link

codspeed-hq bot commented Jan 29, 2024

CodSpeed Performance Report

Merging #8659 will not alter performance

Comparing alex/extra-annotation-str (edad102) with main (b785d5b)

Summary

✅ 10 untouched benchmarks

@alexmojaki alexmojaki merged commit 8b90de8 into main Jan 29, 2024
55 of 56 checks passed
@alexmojaki alexmojaki deleted the alex/extra-annotation-str branch January 29, 2024 13:30
@dmontagu dmontagu mentioned this pull request Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__pydantic_extra__ type hint incompatible with from __future__ import annotations
2 participants