https://github.com/python/cpython/commit/9f63a54aec6fa9bc22382aa1a5a6e47ec12fca23
commit: 9f63a54aec6fa9bc22382aa1a5a6e47ec12fca23
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: freakboy3742 <russ...@keith-magee.com>
date: 2025-06-18T04:19:43Z
summary:

[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 e4ccd46bf75fff2938d7c21c7284e49b0ab795b0)

Co-authored-by: Hood Chatham <roberthoodchat...@gmail.com>

files:
M Lib/test/test_pathlib/test_pathlib.py

diff --git a/Lib/test/test_pathlib/test_pathlib.py 
b/Lib/test/test_pathlib/test_pathlib.py
index 13356b4cfe082b..b2e2cdb3338beb 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -2954,7 +2954,13 @@ def test_glob_dotdot(self):
         else:
             # ".." segments are normalized first on Windows, so this path is 
stat()able.
             self.assertEqual(set(p.glob("xyzzy/..")), { P(self.base, "xyzzy", 
"..") })
-        self.assertEqual(set(p.glob("/".join([".."] * 50))), { P(self.base, 
*[".."] * 50)})
+        if sys.platform == "emscripten":
+            # Emscripten will return ELOOP if there are 49 or more ..'s.
+            # Can remove when 
https://github.com/emscripten-core/emscripten/pull/24591 is merged.
+            NDOTDOTS = 48
+        else:
+            NDOTDOTS = 50
+        self.assertEqual(set(p.glob("/".join([".."] * NDOTDOTS))), { 
P(self.base, *[".."] * NDOTDOTS)})
 
     def test_glob_inaccessible(self):
         P = self.cls

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to