[New-bugs-announce] [issue22276] pathlib glob issues

João Guerra report at bugs.python.org
Tue Aug 26 13:37:22 CEST 2014

New submission from João Guerra:

Both fnmatch and glob support the "*/" glob. However, pathlib does not seem to handle this kind of globs correctly.

dir = Path("/a/directory/")
file = Path("/a/file")
print(dir.match("*/")) # True
print(file.match("*/")) # True

The "/" is being discarded by the match, resulting in incorrect matches.

Both the fnmatch and glob libraries support this correct.
print(fnmatch("/a/directory/", "*/")) # True
print(fnmatch("/a/file", "*/")) # False

Issue 21039 may be related to this.

components: Library (Lib)
messages: 225914
nosy: joca.bt
priority: normal
severity: normal
status: open
title: pathlib glob issues
type: behavior
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list