Skip to content

Analyse typeddict decorators#21267

Merged
hauntsaninja merged 2 commits intopython:masterfrom
pranavmanglik:fix-21030
May 10, 2026
Merged

Analyse typeddict decorators#21267
hauntsaninja merged 2 commits intopython:masterfrom
pranavmanglik:fix-21030

Conversation

@pranavmanglik
Copy link
Copy Markdown
Contributor

Previously, the semantic analyzer's special-case handling for TypedDict (analyze_typeddict_classdef) was returning early without visiting the decorators list in the ClassDef. This caused mypy to silently ignore invalid names, attributes, or subscripted expressions used as decorators on these classes.

Fixes #21030

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks! I made a slightly bigger change to make it match the namedtuple case better / a little bit of related refactoring

@hauntsaninja hauntsaninja changed the title Fix #21030 Analyse typeddict decorators May 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja hauntsaninja merged commit b199f90 into python:master May 10, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined names used as decorators on top of TypedDict are not reported

2 participants