Skip to content

Conversation

@LirongMa
Copy link
Contributor

@LirongMa LirongMa commented Oct 3, 2025

Changes for #55152

@LirongMa LirongMa changed the title [Issue 55152]: Add allow_slice to is_hashable function CLN: Add allow_slice to is_hashable function Oct 3, 2025
@LirongMa LirongMa marked this pull request as ready for review October 5, 2025 20:27
@jbrockmendel
Copy link
Member

Are there non-test places where this is needed?

@LirongMa
Copy link
Contributor Author

LirongMa commented Oct 8, 2025

Are there non-test places where this is needed?

not so far. Because in your PR(#53743 (comment)) you added the checks along with the call to is_hashable(). I added this 'allow_slice' argument based on Richard's suggestion (#55152 (comment))

Let me make some changes to some of the callers and set 'allow_slice' to be False.

@LirongMa LirongMa requested a review from rhshadrach as a code owner October 13, 2025 01:35
# This should never be reached, but let's be explicit about it
raise ValueError("Too many indices") # pragma: no cover
if all(
(is_hashable(x) and not _contains_slice(x)) or com.is_null_slice(x)
Copy link
Member

Choose a reason for hiding this comment

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

i think this is the only usage of _contains_slice, so that can be removed?

Copy link
Member

Choose a reason for hiding this comment

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

@LirongMa can you address this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Member

Choose a reason for hiding this comment

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

i think the _contains_slice function still exists a few lines up

def __hash__(self):
raise TypeError("Not hashable")

class HashableSlice:
Copy link
Member

Choose a reason for hiding this comment

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

comment that we can get rid of that once we drop py311?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comments added

Copy link
Member

Choose a reason for hiding this comment

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

i dont see a comment

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.

CLN: Add is_hashable_non_slice

2 participants