Skip to content

Recompute class MROs in ThirdPass, to handle import loops #1397

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 1 commit into from
Apr 19, 2016

Conversation

rwbarton
Copy link
Contributor

Fixes #1394. This is a bit of a hack, but at least it's simple.

@@ -739,3 +739,18 @@ y = 42
[builtins fixtures/module.py]
[out]
tmp/main.py:4: error: Unsupported left operand type for + ("int")

[case testSuperclassInImportCycle]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this assume that import loops are processed in a particular order? If yes, as we might change the order in the future, it may be better to have another test case would demonstrate the issue if the modules in the import cycle were processed in the opposite order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good point. This test is sensitive to the import order. I added a second test with the imports in the main module reversed.

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 19, 2016

Looks good, just one question about the test case.

Fixes python#1394. This is a bit of a hack, but at least it's simple.
@rwbarton rwbarton force-pushed the rwbarton-loopy-superclasses branch from 0bdf24b to 690c494 Compare April 19, 2016 15:44
@JukkaL JukkaL merged commit 33559c0 into python:master Apr 19, 2016
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