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 allow extra generic #9193

Merged
merged 1 commit into from Apr 9, 2024
Merged

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Apr 9, 2024

Closes #9191

def test_generic_with_allow_extra():
T = TypeVar('T')

# This used to raise an error related to accessing the __annotations__ attribute of the Generic class
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(at least in python 3.9)

@dmontagu dmontagu added the relnotes-fix Used for bugfixes. label Apr 9, 2024
Copy link

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6737afd
Status: ✅  Deploy successful!
Preview URL: https://cf85d627.pydantic-docs2.pages.dev
Branch Preview URL: https://dmontagu-fix-allow-extra-gen.pydantic-docs2.pages.dev

View logs

Copy link

codspeed-hq bot commented Apr 9, 2024

CodSpeed Performance Report

Merging #9193 will not alter performance

Comparing dmontagu/fix-allow-extra-generic (6737afd) with main (8aeac1a)

Summary

✅ 13 untouched benchmarks

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.

Thanks @dmontagu !

@sydney-runkle sydney-runkle enabled auto-merge (squash) April 9, 2024 14:16
@sydney-runkle sydney-runkle merged commit a7d3253 into main Apr 9, 2024
53 of 54 checks passed
@sydney-runkle sydney-runkle deleted the dmontagu/fix-allow-extra-generic branch April 9, 2024 14:23
@samuelcolvin
Copy link
Member

Great work, do we know what changed?

@dmontagu
Copy link
Contributor Author

dmontagu commented Apr 9, 2024

Yes, it was #8659 which was added to handle inheritance of the __pydantic_extra__ annotation, very shortly after the 2.6.0 release. I guess we just never had a test of allowing extra with generic models, which was precisely what was necessary to catch this.

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.

v2.7.0b1 throws error when using OpenAI SDK
3 participants