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

Resolving relative imports does not consider the entire module path #183

Closed
khatchad opened this issue Apr 11, 2024 · 2 comments
Closed
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@khatchad
Copy link
Collaborator

Currently, we only the module name and not the entire path when looking up local modules.

Suppose we have the following package structure:

E/
    __init__.py
    C/
        __init__.py
        A.py
    D/
        __init__.py
        B.py
D/
    __init__.py
    B.py
main.py

When we lookup the local module B.py, currently, we could get either one---E/D/B or D/B.

@khatchad khatchad added the bug Something isn't working label Apr 11, 2024
@khatchad
Copy link
Collaborator Author

Actually, this problem really only shows up in the relative import case, because, in other cases, the relative path (relative to PYTHONPATH) is included in the module name, e.g., E/C/A, when we get to com.ibm.wala.cast.python.parser.PythonModuleParser.getLocalModule(String).

@khatchad
Copy link
Collaborator Author

It would thus seem that, in the case that the import includes the module/package name, the resolved module name (i.e., with the periods removed) should also include the relative path (relative to PYTHONPATH).

@khatchad khatchad added the invalid This doesn't seem right label Apr 11, 2024
@khatchad khatchad closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant