10000 bpo-43757: make pathlib use os.path.realpath() to resolve all symlinks in a path by barneygale · Pull Request #25264 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-43757: make pathlib use os.path.realpath() to resolve all symlinks in a path #25264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 28, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
164dbfd
bpo-43757: make pathlib use os.path.realpath() to resolve all symlink…
barneygale Apr 7, 2021
2894e0a
Adjust `os.path.realpath` to match `pathlib.Path.resolve()` behaviour…
barneygale Apr 8, 2021
495bd8b
Call `os.stat()` to raise `OSError(errno.ELOOP, ...)`.
barneygale Apr 8, 2021
492c66b
Remove unused import
barneygale Apr 8, 2021
c8bac15
Stop ignoring ERROR_CANT_RESOLVE_FILENAME error in _getfinalpathname_…
barneygale Apr 8, 2021
fe69688
Fix symlink detection and `posixpath` tests.
barneygale Apr 8, 2021
4114be9
Raise RuntimeError in Path.resolve() if realpath() raises ERROR_CANT_…
barneygale Apr 8, 2021
2a594ce
Remove unused import
barneygale Apr 8, 2021
fb36a40
Make documentation a little more general to accurately cover Windows.
barneygale Apr 8, 2021
0634486
First pass on fixing `ntpath` tests
barneygale Apr 8, 2021
600fc9e
Second pass on fixing `ntpath` tests
barneygale Apr 8, 2021
047471c
Fix indentation
barneygale Apr 8, 2021
bf3a3f7
Copy description of 'strict' from pathlib.
barneygale Apr 8, 2021
f839db0
Add tests
barneygale Apr 8, 2021
2d30bb7
Add NEWS
barneygale Apr 8, 2021
68c6533
Fix ntpath tests (pass 1)
barneygale Apr 8, 2021
9fa60eb
Add some notes on OS differences
barneygale Apr 10, 2021
f979947
Split NEWS
barneygale Apr 10, 2021
a82bc18
Do not suppress initial ERROR_CANT_RESOLVE_FILENAME error in non-stri…
barneygale Apr 10, 2021
86c318c
realpath(): only raise OSError for symlink loops in strict mode
barneygale Apr 13, 2021
7362f7e
Fix test_ntpath (pass 1)
barneygale Apr 13, 2021
72147c5
Fix test_ntpath (pass 2)
barneygale Apr 13, 2021
df04357
Split up exception handling in resolve() for greater clarity.
barneygale Apr 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Second pass on fixing ntpath tests
  • Loading branch information
barneygale committed Apr 24, 2021
commit 600fc9e7d1b2244ddd28b0e8fa159feab87a84e5
6 changes: 3 additions & 3 deletions Lib/test/test_ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,14 @@ def test_realpath_symlink_loops(self):
ABSTFN + "1\\..\\" + ntpath.basename(ABSTFN) + "1")

os.symlink(ntpath.basename(ABSTFN) + "a\\b", ABSTFN + "a")
self.assertPathEqual(ntpath.realpath(ABSTFN + "a"), ABSTFN + "a")
self.assertRaises(OSError, ntpath.realpath, ABSTFN + "a")

os.symlink("..\\" + ntpath.basename(ntpath.dirname(ABSTFN))
+ "\\" + ntpath.basename(ABSTFN) + "c", ABSTFN + "c")
self.assertPathEqual(ntpath.realpath(ABSTFN + "c"), ABSTFN + "c")
self.assertRaises(OSError, ntpath.realpath, ABSTFN + "c")

# Test using relative path as well.
self.assertPathEqual(ntpath.realpath(ntpath.basename(ABSTFN)), ABSTFN)
self.assertRaises(OSError, ntpath.realpath, ntpath.basename(ABSTFN))

@os_helper.skip_unless_symlink
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
Expand Down
0