Skip to content

Conversation

cdwilson
Copy link
Contributor

@cdwilson cdwilson commented Sep 15, 2024

Change Summary

Prevents a PydanticUserError from being raised when model_config has type annotations (model_config: ConfigDict), but is also empty.

For example, this previously raised a PydanticUserError:

class Model(BaseModel):
    model_config: ConfigDict = {}

Related issue number

Fixes #10411

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

Prevents a `PydanticUserError` from being raised when `model_config` has
type annotations (`model_config: ConfigDict`), but is also empty.

For example, this previously raised a `PydanticUserError`:

class Model(BaseModel):
    model_config: ConfigDict = {}

Fixes pydantic#10411
@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Sep 15, 2024
Copy link

codspeed-hq bot commented Sep 15, 2024

CodSpeed Performance Report

Merging #10412 will not alter performance

Comparing tinydantic:cdwilson/fix-issue-10411 (ec1a501) with main (5d5b8af)

Summary

✅ 49 untouched benchmarks

Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _config.py
Project Total  

This report was generated by python-coverage-comment-action

@Viicos
Copy link
Member

Viicos commented Sep 15, 2024

Thanks for the bug report and fix @cdwilson

@Viicos Viicos merged commit a764871 into pydantic:main Sep 15, 2024
60 checks passed
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.

PydanticUserError raised when model_config has type annotation and is empty
2 participants