Skip to content

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jul 28, 2023

Closes #6931

The issue is that the BaseModel class, specifically, is lying about some of its attribute annotations and doesn't have certain attributes that every subclass would have (namely, __pydantic_generic_metadata__). Fortunately, the affected functions are currently only used in ways where they shouldn't do anything interesting for BaseModel, so I just modified them to not return True for BaseModel itself, and it seems everything "just works" with that change.

@dmontagu
Copy link
Contributor Author

please review

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 28, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7ea383f
Status: ✅  Deploy successful!
Preview URL: https://1cec1c2e.pydantic-docs2.pages.dev
Branch Preview URL: https://fix-generic-parametrized-wit.pydantic-docs2.pages.dev

View logs

@dmontagu dmontagu enabled auto-merge (squash) July 28, 2023 15:34
@dmontagu dmontagu disabled auto-merge July 28, 2023 15:34
@dmontagu dmontagu enabled auto-merge (squash) July 28, 2023 15:35
@dmontagu dmontagu merged commit bb43605 into main Jul 28, 2023
@dmontagu dmontagu deleted the fix-generic-parametrized-with-basemodel branch July 28, 2023 15:38
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.

Generic Models cannot be typed with BaseModel subclasses
2 participants