Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-114847: Speed upposixpath.realpath()#114848

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
barneygale merged 23 commits intopython:mainfrombarneygale:gh-114847
Apr 5, 2024
Merged
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
0a4f60a
GH-114847: Speed up `posixpath.realpath()`
barneygaleFeb 1, 2024
5aa9c51
Tiny tweak
barneygaleFeb 1, 2024
b758710
Slightly speed up handling of empty/dot parts
barneygaleFeb 1, 2024
eb079b4
Merge branch 'main' into gh-114847
barneygaleMar 31, 2024
60d3bcb
Simplify '..' handling.
barneygaleMar 31, 2024
b849308
A few more perf improvements and simplifications.
barneygaleMar 31, 2024
085e105
Simplify symlink resolution signalling
barneygaleMar 31, 2024
69dabd2
Tiny tweaks
barneygaleMar 31, 2024
197c871
Spacing
barneygaleMar 31, 2024
b03e474
Merge branch 'main' into gh-114847
barneygaleApr 1, 2024
ecd1fe7
Comments
barneygaleApr 1, 2024
4b83c97
Final tweaks
barneygaleApr 1, 2024
77712d2
Further explain 'rest'.
barneygaleApr 1, 2024
15199a8
Update Lib/posixpath.py
barneygaleApr 2, 2024
8b3b808
Merge branch 'main' into gh-114847
barneygaleApr 2, 2024
01127e3
Merge branch 'main' into gh-114847
barneygaleApr 3, 2024
31955ee
Undo re-ordering of lstat() and seen lookup
barneygaleApr 3, 2024
211167e
Merge branch 'main' into gh-114847
barneygaleApr 3, 2024
fe62fef
Re-optimise link check
barneygaleApr 4, 2024
ebccd2b
Stop querying when `lstat()` fails.
barneygaleApr 4, 2024
d2a0248
Keep querying if we hit an OSError from lstat()
barneygaleApr 4, 2024
ecbb27c
Merge branch 'main' into gh-114847
barneygaleApr 4, 2024
eed739a
Update Lib/posixpath.py
barneygaleApr 5, 2024
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
PrevPrevious commit
NextNext commit
Slightly speed up handling of empty/dot parts
  • Loading branch information
@barneygale
barneygale committedFeb 1, 2024
commitb7587109db4d1c2e47e4b75901c01477a1427f94
9 changes: 4 additions & 5 deletionsLib/posixpath.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -448,17 +448,15 @@ def realpath(filename, *, strict=False):
querying = True
path = sep if filename.startswith(sep) else getcwd()
for part in reversed(filename.split(sep)):
stack.append((False, part))
if part and part != curdir:
stack.append((False, part))

while stack:
is_symlink, name = stack.pop()
if is_symlink:
# resolved symlink
seen[name] = path
continue
if not name or name == curdir:
# current dir
continue
if name == pardir:
# parent dir
newpath, name = split(path)
Expand DownExpand Up@@ -509,7 +507,8 @@ def realpath(filename, *, strict=False):
path = sep
stack.append((True, newpath))
for part in reversed(target.split(sep)):
stack.append((False, part))
if part and part != curdir:
stack.append((False, part))
return path


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp