-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[llvm-lit] Fix Unhashable TypeError when using lit's internal shell #101590
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
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f7aab48
[llvm-lit] Unhashable type Support
Harini0924 2bb5b51
Merge branch 'main' into fixing_unhasable
Harini0924 2408040
[llvm-lit] Fix handling of GlobItem in args[0] to ensure it is hashable
Harini0924 25b1bd7
[llvm-lit] Simplify args[0] Hashability Check and Expansion
Harini0924 bdea995
[llvm-lit] Fixed a comment
Harini0924 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to get your feedback on the recent changes I made. Specifically, I added a check to ensure args[0] is hashable before using it in inproc_builtins. If args[0] is an instance of GlobItem, I'm expanding it to its full path. I wasn't sure if this approach is the most efficient or if there's a better way to resolve the GlobItem TypeError. Any insights or suggestions for improvement would be greatly appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a check if it's
Hashable
though, it's just a check if the instance is aGlobItem
.Why not just do the expansion at the call site though?
expand_glob()
is already checking if it's aGlobItem
. It also won't modifyargs[0]
, which seems preferable, sinceexpand_glob_expressions()
goes out of its way not to modifyargs[0]
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the implementation to ensure
args[0]
is hashable before using it in inproc_builtins. The previous code:has been modifed to:
You raised a valid point about performing the expansion at the call site, as
expand_glob()
already checks ifargs[0]
is aGlobItem
and does not modifyargs[0]
, which aligns with the approach taken byexpand_glob_expressions()
. However, the current errorTypeError: unhashable type: 'GlobItem'
occurs on the line:After changing this line to:
the same
TypeError
occurs on subsequent lines whereargs[0]
is called. Instead of repeatedly applying the same functionality toargs[0]
until line 866 where args is expanded with:it would be more efficient to expand args[0] before invoking any in-process built-ins. This approach resolves the
TypeError
for this and all subsequent lines whereargs[0]
is used.By making this change, we address the issue holistically, ensuring the robustness of the implementation against unhashable types like
GlobItem
.Let me know if this approach works for you or if you have any further suggestions.