Skip to content
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

New analyser: better processing of import cycles with star imports #7141

Closed
ilevkivskyi opened this issue Jul 3, 2019 · 3 comments
Closed
Assignees
Labels
needs discussion priority-0-high semantic-analyzer Problems that happen during semantic analysis

Comments

@ilevkivskyi
Copy link
Member

Consider this test case:

[case testClassDeferredStar]
import lib
[file lib.py]
from other import *

class C:
    x: int
[file other.py]
import lib

Currently the order of processing targets is like this:

  • lib
  • other
  • lib
  • __main__

I think it should be possible to process such SCC without deferral at all. Couple ideas to achieve this:

  • Better ordering of targets within SCC
  • Make missing_names act per namespace (to avoid extra deferral in more complex scenarios)
@ilevkivskyi ilevkivskyi added needs discussion priority-1-normal semantic-analyzer Problems that happen during semantic analysis labels Jul 3, 2019
@ilevkivskyi
Copy link
Member Author

Currently this affects two plugin test cases testTypeInAttrDeferredStar and testTypeInDataclassDeferredStar.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 4, 2019

It looks like we generally process modules in a very sub-optimal order. I'll see what happens if we reverse the order.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 8, 2019

Fixed by #7163.

@JukkaL JukkaL closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion priority-0-high semantic-analyzer Problems that happen during semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants