Repository navigation
fix: is_uuid4 rejects valid UUID4 strings with uppercase hex digits - #3041
Open
Shubham-Padkonde wants to merge 1 commit into
Open
Shubham-Padkonde wants to merge 1 commit into
Shubham-Padkonde wants to merge 1 commit into
Conversation
is_uuid4() compared str(UUID(input, version=4)) against the raw input. str(UUID(...)) always returns a lowercase string, so any input containing uppercase hex digits (e.g. "550E8400-E29B-41D4-A716-446655440000") would never equal the lowercase result, causing is_uuid4 to silently return False for valid UUID4 values. Fix by dropping the string round-trip in favour of checking the .version attribute directly. UUID.version returns None for non-RFC-4122 UUIDs and the integer version number otherwise, so the comparison is both correct and case-independent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012acaiEt2JyZdUxjQndUWQL
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem and change
is_uuid4()rejects valid UUID4 strings containing uppercase or mixed-case hexadecimal digits because it compares the parser's lowercase output with the original string. Parse the supplied value without forcing its version and check that its actual UUID version is 4. Existing UUID objects and invalid/non-string inputs retain their explicit handling.The regression tests cover lowercase, uppercase, mixed-case, UUID objects, version-1 UUIDs, malformed strings, integers and None. No corresponding issue link has been identified; this description does not claim to close one.
Pre-review checklist
Validation
At the current PR commit
d69353241eec9e0665bc454ad7b3a71be6d5d21c, all nineTestIsUuid4tests pass on Windows with the existing test environment; 96 unrelated tests in the module were deselected. Pytest reports three existing configuration warnings. The full connector suite and live Snowflake integrations were not run for this follow-up. Hosted test workflows still require maintainer approval.Original implementation attribution: Claude Code, as disclosed in the previous PR description.
Codex reviewed the current diff, ran the focused validation above, and updated this description.