diff options
Diffstat (limited to 'Lib/glob.py')
-rw-r--r-- | Lib/glob.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/glob.py b/Lib/glob.py index 3431a69..00f867f 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -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] |