summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-01-30 15:51:35 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-01-30 15:51:35 (GMT)
commit396cbd6dfd93ca126772c1e534d28988a6fa29ad (patch)
treea0162cfa12ccfa65c689040c0a871ba7754fc944 /Lib/pathlib.py
parent5586ba7643e608827fc7109a40e851f3cae0f2e4 (diff)
parent4a208e448e80ac1ce2bc805685d68da69dd44841 (diff)
downloadcpython-396cbd6dfd93ca126772c1e534d28988a6fa29ad.zip
cpython-396cbd6dfd93ca126772c1e534d28988a6fa29ad.tar.gz
cpython-396cbd6dfd93ca126772c1e534d28988a6fa29ad.tar.bz2
Issue #23076: Path.glob() now raises a ValueError if it's called with an
invalid pattern. Patch by Thomas Nyberg.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index bbac773..5169ff5 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1065,6 +1065,8 @@ class Path(PurePath):
"""Iterate over this subtree and yield all existing files (of any
kind, including directories) matching the given pattern.
"""
+ if not pattern:
+ raise ValueError("Unacceptable pattern: {!r}".format(pattern))
pattern = self._flavour.casefold(pattern)
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
if drv or root: