Skip to content

Commit 621f631

Browse files
Expand ~
1 parent 5d8e432 commit 621f631

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/glob.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False,
4545
"""
4646
sys.audit("glob.glob", pathname, recursive)
4747
sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
48+
# expand ~; see issue 84037
49+
if pathname.startswith('~'):
50+
from pathlib import Path
51+
pathname = pathname.replace('~', str(Path.home()), 1)
4852
if root_dir is not None:
4953
root_dir = os.fspath(root_dir)
5054
else:

0 commit comments

Comments
 (0)