| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1065,6 +1065,8 @@ def glob(self, pattern): | |||
| 1065 | 1065 | """Iterate over this subtree and yield all existing files (of any | |
| 1066 | 1066 | kind, including directories) matching the given pattern. | |
| 1067 | 1067 | """ | |
| 1068 | + if not pattern: | ||
| 1069 | + raise ValueError("Unacceptable pattern: {!r}".format(pattern)) | ||
| 1068 | 1070 | pattern = self._flavour.casefold(pattern) | |
| 1069 | 1071 | drv, root, pattern_parts = self._flavour.parse_parts((pattern,)) | |
| 1070 | 1072 | if drv or root: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1969,6 +1969,11 @@ def test_unsupported_flavour(self): | |||
| 1969 | 1969 | else: | |
| 1970 | 1970 | self.assertRaises(NotImplementedError, pathlib.WindowsPath) | |
| 1971 | 1971 | ||
| 1972 | + def test_glob_empty_pattern(self): | ||
| 1973 | + p = self.cls() | ||
| 1974 | + with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'): | ||
| 1975 | + list(p.glob('')) | ||
| 1976 | + | ||
| 1972 | 1977 | ||
| 1973 | 1978 | @only_posix | |
| 1974 | 1979 | class PosixPathTest(_BasePathTest, unittest.TestCase): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1038,6 +1038,7 @@ Neal Norwitz | |||
| 1038 | 1038 | Mikhail Novikov | |
| 1039 | 1039 | Michal Nowikowski | |
| 1040 | 1040 | Steffen Daode Nurpmeso | |
| 1041 | + Thomas Nyberg | ||
| 1041 | 1042 | Nigel O'Brian | |
| 1042 | 1043 | John O'Connor | |
| 1043 | 1044 | Kevin O'Connor | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,6 +73,9 @@ Library | |||
| 73 | 73 | - Issue #26202: copy.deepcopy() now correctly copies range() objects with | |
| 74 | 74 | non-atomic attributes. | |
| 75 | 75 | ||
| 76 | + - Issue #23076: Path.glob() now raises a ValueError if it's called with an | ||
| 77 | + invalid pattern. Patch by Thomas Nyberg. | ||
| 78 | + | ||
| 76 | 79 | - Issue #19883: Fixed possible integer overflows in zipimport. | |
| 77 | 80 | ||
| 78 | 81 | - Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and | |
| Back | FazBrowse Home | New Git URL |
0 commit comments