Skip to content

model config in inheritance doesn't respect MRO #9992

@KotlinIsland

Description

@KotlinIsland

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

in the example below, the output should be True in my opinion because A is first in the mro.

Example Code

from pydantic import BaseModel, ConfigDict


class A(BaseModel):
    model_config = ConfigDict(strict=True)


class B(BaseModel):
    model_config = ConfigDict(strict=False)


class C(A, B):
    pass


print(C.model_config["strict"])  # False

Python, Pydantic & OS Version

pydantic version: 2.8.2
        pydantic-core version: 2.20.1
          pydantic-core build: profile=release pgo=true
                 install path: C:\Users\AMONGUS\projects\test\.venv\Lib\site-packages\pydantic
               python version: 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]
                     platform: Windows-10-10.0.19045-SP0
             related packages: typing_extensions-4.12.2
                       commit: unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    changeSuggested alteration to Pydantic, not a new feature nor a bugv3Under consideration for V3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions