KEMBAR78
Handle `__pydantic_extra__` annotation being a string or inherited by alexmojaki · Pull Request #8659 · pydantic/pydantic · GitHub
Skip to content

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 requested a review from adriangb January 29, 2024 11:47
@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
@codspeed-hq
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

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