Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f63a54

Browse files
[3.14] gh-127146: Emscripten: Fix pathlib glob_dotdot test (GH-135624) (#135653)
The Emscripten path resolver uses the same mechanism for resolving `..` at a file system root as for resolving symlinks. This is because roots don't store their mountpoints. If the parent of a node is itself, it is a root but it might be a mountpoint in some other file system. If a path has enough `..`'s at the root, it will return ELOOP. Enough turns out to be 49. (cherry picked from commit e4ccd46) Co-authored-by: Hood Chatham <[email protected]>
1 parent a61bd7a commit 9f63a54

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,7 +2954,13 @@ def test_glob_dotdot(self):
29542954
else:
29552955
# ".." segments are normalized first on Windows, so this path is stat()able.
29562956
self.assertEqual(set(p.glob("xyzzy/..")), { P(self.base, "xyzzy", "..") })
2957-
self.assertEqual(set(p.glob("/".join([".."] * 50))), { P(self.base, *[".."] * 50)})
2957+
if sys.platform == "emscripten":
2958+
# Emscripten will return ELOOP if there are 49 or more ..'s.
2959+
# Can remove when https://github.com/emscripten-core/emscripten/pull/24591 is merged.
2960+
NDOTDOTS = 48
2961+
else:
2962+
NDOTDOTS = 50
2963+
self.assertEqual(set(p.glob("/".join([".."] * NDOTDOTS))), { P(self.base, *[".."] * NDOTDOTS)})
29582964

29592965
def test_glob_inaccessible(self):
29602966
P = self.cls

0 commit comments

Comments
 (0)