Repository navigation
Conversation
Assisted-by: OpenAI Codex
Wkhanex
reviewed
Oct 14, 2026
Wkhanex
left a comment
There was a problem hiding this comment.
Replacement names with directory/drive components are rejected under both POSIX and Windows path modules, including Windows drive-relative names. Valid sibling filenames still keep the original directory.
Checked 3db027d99702 with standalone Python 3.12.14 checks (13 passing assertions). I haven't run the full upstream suite.
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.
Path('data/report.txt').with_name('../other.txt')currently returnsdata/../other.txt, although replacing a filename should reject directorycomponents. Empty names,
'.', and Windows drive components are also accepted.Validate the replacement name through the configured path module before
constructing the result. This preserves POSIX backslashes as literal filename
characters and rejects both Windows separator forms and drive-qualified names.
with_steminherits the validation through its existing call towith_name.Refs #214. This change only covers replacement-name validation; it does not
claim complete pathlib compatibility or close the compatibility checklist.
Validation on macOS, Python 3.11.5:
deprecation warning. Plugin autoload was disabled and filterwarnings cleared
to run the functional suite without optional plugin dependencies.
as unchanged main, with no new diagnostics. This is not a clean lint pass.
Focused command:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python3 -m pytest tests/test_path.py -k 'with_name or with_stem' -q -o addopts= -o filterwarnings= --tb=shortFull functional command:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python3 -m pytest tests/ path/ -q --doctest-modules -o addopts= -o filterwarnings= --tb=shortPOSIX and Windows path parsing are covered via posixpath and ntpath. Native
Windows execution and other Python versions were not run.
AI disclosure: Implementation, tests, and this description were prepared with
OpenAI Codex assistance. The checks above were executed locally.