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

Update benchmark of relation/import/GlobalImport #12

Open
thisrabbit opened this issue Mar 6, 2023 · 0 comments
Open

Update benchmark of relation/import/GlobalImport #12

thisrabbit opened this issue Mar 6, 2023 · 0 comments
Assignees

Comments

@thisrabbit
Copy link
Contributor

Background

Currently the benchmark case demonstrating global import dependency involves in circular dependency, which makes the case too ambiguous and confusing.

Given that case, python module_a.py will work fine, however python module_b.py will throw the following error:

Traceback (most recent call last):
  File "...\module_b.py", line 1, in <module>
    from module_a import func as f, x as x_b, ClassA as c
  File "...\module_a.py", line 1, in <module>
    import module_b
  File "...\module_b.py", line 1, in <module>
    from module_a import func as f, x as x_b, ClassA as c
ImportError: cannot import name 'func' from partially initialized module 'module_a' (most likely due to a circular import) (...\module_a.py)

If you move the first line of module_a.py (import module_b) to the last, then both commands will work properly.

This is something related to circular import, and to understand this concept, I would recommend reading this SO post.

Suggestion

Separate this benchmark case into standalone cases that demonstrate regular imports and circular imports respectively.

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

No branches or pull requests

2 participants