-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[red-knot] More precise inference for classes with non-class metaclasses #15138
Conversation
|
5fae944
to
ec6da41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you! Will apply my diagnostic wording nit and then merge.
Oops, looks like this needs a rebase before it can land. I don't have time to do that right now, but will merge if you're able to do it. |
Sorry, I should have clarified that it's not just a rebase -- the rebase causes logical conflicts that make compilation fail. |
Head branch was pushed to by a user without write access
22a48ec
to
4b8686b
Compare
Indeed, now there's a panic that I can't make heads or tails of:
Here's the code in question: def f(*args, **kwargs) -> int: ... # 169 (not even modified)
class A(metaclass=f): ... # 171 (also not modified) I'm also getting |
I can repro this, will take a couple minutes to look at it and see if I can understand it.
No, but I suspect this is related to the use of a symlink to include |
The panic is due to a Salsa query cycle. Still looking into why it's new after the rebase. |
Strange that our CI tests on Windows seem to have no problem with it? I can take a look tomorrow. |
Ok, I tracked down the cycle. It's new with the rebase because we are now doing proper call binding. What happens is that we call the metaclass I think this reveals a bug in the PR that I hadn't noticed. The first argument to the metaclass is not the actual class object, as modeled in the PR via
If we correctly reflect this by passing |
For future reference, the technique I found most effective for tracking down the cause of the cycle was simply adding Using query tracing (in red-knot or Salsa) was ineffective in this case, because the cycle was a single-query cycle: it was just |
Summary
Resolves #14208.
Test Plan
Markdown tests.