Skip to content

Do models.Model adjustments from get_metaclass_hook - #2322

Merged
sobolevn merged 1 commit into
typeddjango:masterfrom
flaeppe:fix/2304
Aug 6, 2024
Merged

Do models.Model adjustments from get_metaclass_hook#2322
sobolevn merged 1 commit into
typeddjango:masterfrom
flaeppe:fix/2304

Conversation

@flaeppe

@flaeppe flaeppe commented Aug 6, 2024

Copy link
Copy Markdown
Member

The called hook expects/wants the class body analyzed, but the get_customize_class_mro_hook hook, that it was previously called from, invokes the hook before the class body has been analyzed..

Docs: https://mypy.readthedocs.io/en/stable/extending_mypy.html#current-list-of-plugin-hooks

get_customize_class_mro_hook() can be used to modify class MRO (for example insert some entries there) before the class body is analyzed.

Related issues

The called hook expects/wants the class body analyzed, but the
`get_customize_class_mro_hook` hook, that it was previously called from,
invokes the hook before the class body has been analyzed..

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I think that we didn't have this hook back in the days of the original code.

@sobolevn
sobolevn merged commit ac2b526 into typeddjango:master Aug 6, 2024
@flaeppe
flaeppe deleted the fix/2304 branch August 6, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[5.0.3 regression] error: "type[RealmFilter]" has no attribute "objects" [attr-defined]

2 participants