summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-05-10 17:17:08 (GMT)
committerGitHub <noreply@github.com>2023-05-10 17:17:08 (GMT)
commita33ce66dca57d4c36b1022fdf3b7e322f3203468 (patch)
tree65ab2d9b7e48c20ecd03028bbd466e16b0f06c05 /Lib/test/test_pathlib.py
parent7a3b03509e5e3e72d8c47137579cccb52548a318 (diff)
downloadcpython-a33ce66dca57d4c36b1022fdf3b7e322f3203468.zip
cpython-a33ce66dca57d4c36b1022fdf3b7e322f3203468.tar.gz
cpython-a33ce66dca57d4c36b1022fdf3b7e322f3203468.tar.bz2
GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)
Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered a symlink to an overly long path.
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index ee0ef9a..10dd604 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1977,6 +1977,15 @@ class _BasePathTest(object):
subdir.chmod(000)
self.assertEqual(len(set(base.glob("*"))), 4)
+ @os_helper.skip_unless_symlink
+ def test_glob_long_symlink(self):
+ # See gh-87695
+ base = self.cls(BASE) / 'long_symlink'
+ base.mkdir()
+ bad_link = base / 'bad_link'
+ bad_link.symlink_to("bad" * 200)
+ self.assertEqual(sorted(base.glob('**/*')), [bad_link])
+
def _check_resolve(self, p, expected, strict=True):
q = p.resolve(strict)
self.assertEqual(q, expected)