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.
diff --git a/Lib/glob.py b/Lib/glob.py
index 36d493d..7279244 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -29,7 +29,10 @@
         for name in glob1(None, basename):
             yield name
         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]