Skip to content

fix foo = classmethod(foo) does not create a working classmethod #3362 - #4796

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:3362
Open

fix foo = classmethod(foo) does not create a working classmethod #3362#4796
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:3362

Conversation

@asukaminato0721

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3362

Recognizes f = classmethod(f) during binding and types cls as type[Self], preserves subclass-aware return inference and class-attribute initialization, avoids triggering when classmethod is shadowed.

Test Plan

add test

@meta-cla meta-cla Bot added the cla signed label Sep 3, 2026
@github-actions github-actions Bot added the size/m label Sep 3, 2026
@meta-codesync

meta-codesync Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D118597715. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

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.

foo = classmethod(foo) does not create a working classmethod

2 participants