Repository navigation
Conversation
…#714) ps_path_realpath used to raise whenever realpath(3) failed, while CPython's default strict=False resolves the existing leading components and joins the rest of the path lexically. Shrink to the longest prefix realpath() accepts and join the remainder verbatim, so os.path.realpath('a/../b') on a missing target no longer diverges from CPython 3.14. Closes #714
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.
What
ps_path_realpathpreviously raised wheneverrealpath(3)failed. CPython'sos.path.realpathdefaults tostrict=False: it resolves symlinks on theexisting leading components and, when the target is missing, joins the
remaining tail lexically (mirroring
posixpath._joinrealpath).The rewrite keeps the fast path when
realpath(3)succeeds and otherwiseshrinks to the longest prefix
realpath()can resolve, then joins the restverbatim through
ps_path_join— soos.path.basename(os.path.realpath('a/../b')) == 'b'traces correctly (abs → normpath → missing leaf → join → basename
'b').The differential sweep's
REALPATH_DIVERGENCEreference and the probe'sdivergence=kwarg are removed, so thepathsbatch now passes on its own.Stacking
This PR is stacked on #713 (which is stacked on #712 on #715). Merge order:
#715 → #712 → #713 → this PR.
Testing
tests/test_stdlib_call_table.py— the realpath probe now expects theCPython strict=False result (no divergence reference).
gcc -fsyntax-only -Wallcheck ofps_path.cagainst the runtimeheader contract passes.
Closes #714