diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-12-16 13:50:19 +0100 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-12-16 13:50:19 +0100 |
commit | 3c331bb729b78419da455b9f8be81b566cb7a489 (patch) | |
tree | fc4d13b0097f323d7a075dd030ab4846238cff40 /Lib/test/test_glob.py | |
parent | 9ca589333844997713394b65dba9548c5887e750 (diff) | |
parent | 3d068b2ecfd0e04d61289dce5abed60cd88b4f9f (diff) | |
download | cpython-git-3c331bb729b78419da455b9f8be81b566cb7a489.tar.gz |
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.
Diffstat (limited to 'Lib/test/test_glob.py')
-rw-r--r-- | Lib/test/test_glob.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index 806f26b309..8972b8f0a2 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -4,6 +4,7 @@ from test.support import (run_unittest, TESTFN, skip_unless_symlink, import glob import os import shutil +import sys class GlobTests(unittest.TestCase): @@ -110,6 +111,18 @@ class GlobTests(unittest.TestCase): eq(self.glob('sym1'), [self.norm('sym1')]) eq(self.glob('sym2'), [self.norm('sym2')]) + @unittest.skipUnless(sys.platform == "win32", "Win32 specific test") + def test_glob_magic_in_drive(self): + eq = self.assertSequencesEqual_noorder + eq(glob.glob('*:'), []) + eq(glob.glob(b'*:'), []) + eq(glob.glob('?:'), []) + eq(glob.glob(b'?:'), []) + eq(glob.glob('\\\\?\\c:\\'), ['\\\\?\\c:\\']) + eq(glob.glob(b'\\\\?\\c:\\'), [b'\\\\?\\c:\\']) + eq(glob.glob('\\\\*\\*\\'), []) + eq(glob.glob(b'\\\\*\\*\\'), []) + def test_main(): run_unittest(GlobTests) |