Skip to content

Conversation

@taminomara
Copy link

@taminomara taminomara commented Oct 24, 2025

This PR continues work by @dzherb from #134073.

I've simplified the code and removed strict checks from _is_type. Supporting arbitrary levels of module nesting turned out to be beneficial for overall code complexity, so I've included it to this PR; I can send it as a separate PR with a separate issue, though.

Motivation for current implementation

I think we shouldn't assume anything about user-provided type annotations. All we know from annotation ty.ClassVar is that there is an object ty, and we're getting its attribute ClassVar. We shouldn't assume that ty is a module, nor that it doesn't implement some custom __getattr__ logic; instead, we should just do what the annotation tells us to do.

@python-cla-bot
Copy link

python-cla-bot bot commented Oct 24, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@taminomara taminomara force-pushed the gh-133956-broken-classvar branch from 5ecae28 to 2f64527 Compare October 24, 2025 12:29
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.

2 participants