mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #16626: Fix infinite recursion in glob.glob() on Windows when the pattern contains a wildcard in the drive or UNC path.
Patch by Serhiy Storchaka.
This commit is contained in:
commit
39a6ee20ac
3 changed files with 21 additions and 1 deletions
|
@ -28,7 +28,10 @@ def iglob(pathname):
|
|||
if not dirname:
|
||||
yield from glob1(None, basename)
|
||||
return
|
||||
if has_magic(dirname):
|
||||
# `os.path.split()` returns the argument itself as a dirname if it is a
|
||||
# drive or UNC path. Prevent an infinite recursion if a drive or UNC path
|
||||
# contains magic characters (i.e. r'\\?\C:').
|
||||
if dirname != pathname and has_magic(dirname):
|
||||
dirs = iglob(dirname)
|
||||
else:
|
||||
dirs = [dirname]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue