summaryrefslogtreecommitdiff
path: root/Lib/macpath.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-09-18 11:28:51 +0300
committerGitHub <noreply@github.com>2018-09-18 11:28:51 +0300
commit0185f34ddcf07b78feb6ac666fbfd4615d26b028 (patch)
treea27f02f0095d5a7fb1fcbd539114b3a74fb4fcc7 /Lib/macpath.py
parent7bdf28265aa371b39f82dfc6562635801aff15a5 (diff)
downloadcpython-git-0185f34ddcf07b78feb6ac666fbfd4615d26b028.tar.gz
bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant to invalid paths. (#7695)
Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(), os.path.isfile(), os.path.islink(), and os.path.ismount() now return False instead of raising ValueError or its subclasses UnicodeEncodeError and UnicodeDecodeError for paths that contain characters or bytes unrepresentative at the OS level.
Diffstat (limited to 'Lib/macpath.py')
-rw-r--r--Lib/macpath.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/macpath.py b/Lib/macpath.py
index aacf7235b0..9a12d2feee 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -138,7 +138,7 @@ def lexists(path):
try:
st = os.lstat(path)
- except OSError:
+ except (OSError, ValueError):
return False
return True