Repository navigation
python: reject a bare str or bytes in identify_paths (#1472) - #1476
Open
kaluli123123 wants to merge 3 commits into
Open
kaluli123123 wants to merge 3 commits into
kaluli123123 wants to merge 3 commits into
Conversation
`str` and `bytes` are registered as `collections.abc.Sequence`, so the container guard in `identify_paths()` let them through. The string was then iterated character by character and the call returned one bogus `MagikaResult` per character instead of raising `TypeError` — including a `Status.OK` `directory` result for the `.` component. Exclude `str`/`bytes` from the guard, which is the only place this can be caught: a bare `str` type-checks fine against `Sequence[Union[str, os.PathLike]]`. Fixes google#1472
1 of 7 tasks
Collaborator
|
Thank you! I checked this against the current |
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.
Fixes #1472.
Rejects bare
str/bytesinidentify_paths()while preserving valid path sequences andidentify_path(str). Mergedmainat8d3d3b9without expanding the fix.Python 3.13 validation: focused regression passed; non-slow suite 40 passed / 1 skipped; lock, Ruff, formatting, mypy, copyright and real path-input/CLI/module smokes passed.
The broader unchanged Rust baseline hit a macOS FFI dynamic-linker error; this is not a full Rust-suite pass. Current-head CI and formal maintainer approval remain required.