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

Fix user import when it overlaps with runtime library modules #1743

Merged
merged 5 commits into from
Apr 23, 2023

Conversation

Shaikh-Ubaid
Copy link
Collaborator

@Shaikh-Ubaid Shaikh-Ubaid commented Apr 22, 2023

fixes #1737.

@Shaikh-Ubaid
Copy link
Collaborator Author

Shaikh-Ubaid commented Apr 22, 2023

There could be other approaches to fix #1737, for example, changing/reversing the priority of runtime library path and parent_dir or using name mangling.

This PR fixes the issue by pruning the paths to be searched (as we need not re-search for the package/module).

@Shaikh-Ubaid Shaikh-Ubaid marked this pull request as draft April 22, 2023 21:20
@Shaikh-Ubaid
Copy link
Collaborator Author

This is ready. Please review and share feedback.

@Shaikh-Ubaid Shaikh-Ubaid marked this pull request as ready for review April 22, 2023 21:58
@Thirumalai-Shaktivel
Copy link
Collaborator

Thirumalai-Shaktivel commented Apr 23, 2023

LGTM! Thanks for fixing this!

@certik certik requested a review from czgdp1807 April 23, 2023 04:04
Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think it's fine. @czgdp1807 can you also please review?

@@ -0,0 +1,2 @@
def hi_from_user_sys():
print("hi from user sys!")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably return an integer value from here.

@@ -0,0 +1,3 @@
from test_import.sys import hi_from_user_sys

hi_from_user_sys()
Copy link
Collaborator

Choose a reason for hiding this comment

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

And then assert here. So that we know that we are not having any hidden bugs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done! Thanks for the guidance!

@Shaikh-Ubaid
Copy link
Collaborator Author

I am adding this to auto-merge as it seems approved.

@Shaikh-Ubaid Shaikh-Ubaid merged commit 5fe474b into lcompilers:main Apr 23, 2023
@Shaikh-Ubaid Shaikh-Ubaid deleted the fix_import branch April 23, 2023 08:02
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.

If you create module a.sys, it fails
4 participants