Skip to content

Add shared checker interface to break import cycle #18878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 4, 2025

Conversation

ilevkivskyi
Copy link
Member

The import cycle is not a real one as if TYPE_CHECKING: ... is used, but it would become much bigger if I start using checkmember in subtypes, essentially it would be one huge import cycle during self-checking. So I decided to do something similar we did for semantic analyzer.

@ilevkivskyi ilevkivskyi requested review from JukkaL and tyralla April 4, 2025 08:56

This comment has been minimized.

@ilevkivskyi ilevkivskyi closed this Apr 4, 2025
@ilevkivskyi ilevkivskyi reopened this Apr 4, 2025

This comment has been minimized.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good, just have questions about one change.

mypy/semanal.py Outdated
isinstance(item, Decorator) and item.func.abstract_status == IS_ABSTRACT
for item in defn.items
):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a behaviour change? If yes, maybe add a test, or would this be better included in a separate PR if mypyc doesn't support this yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I didn't want to add an implementation for couple overloaded methods with many parameters, but unfortunately it didn't work with mypyc. I will put it into a separate PR.

Copy link
Contributor

github-actions bot commented Apr 4, 2025

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

@ilevkivskyi ilevkivskyi merged commit 4f284a3 into python:master Apr 4, 2025
18 checks passed
@ilevkivskyi ilevkivskyi deleted the checker-shared branch April 4, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants