mirror of
https://github.com/python/cpython.git
synced 2025-09-07 01:11:26 +00:00
[3.11] GH-87695: Fix OSError from pathlib.Path.glob()
(GH-104292) (GH-104362)
Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered
a symlink to an overly long path.
(cherry picked from commit a33ce66dca
)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
parent
1cbf844875
commit
846a23d0b8
3 changed files with 13 additions and 2 deletions
|
@ -1790,6 +1790,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue