Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
# Internals
#

# EBADF - guard agains macOS `stat` throwing EBADF
_IGNORED_ERROS = (ENOENT, ENOTDIR, EBADF)
# EBADF - guard against macOS `stat` throwing EBADF
# EINVAL - `stat` on Windows throws it for invalid paths
_IGNORED_ERROS = (ENOENT, ENOTDIR, EBADF, EINVAL)

def _is_wildcard_pattern(pat):
# Whether this pattern needs actual matching using fnmatch, or can
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,9 @@ def test_rglob(self):
p = P(BASE, "dirC")
self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })

def test_exists_for_invalid_path(self):
self.assertEqual(self.cls("*").exists(), False)

def test_expanduser(self):
P = self.cls
with support.EnvironmentVarGuard() as env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle '*' in pathlib.Path.exists on Windows