[New-bugs-announce] [issue21464] fnmatch module uses undefined regular expression to perform matching
report at bugs.python.org
Fri May 9 23:24:07 CEST 2014
New submission from Paul Sokolovsky:
fnmatch.translate() ends with:
return res + '\Z(?ms)'
However, https://docs.python.org/3.4/library/re.html#regular-expression-syntax states:
Note that the (?x) flag changes how the expression is parsed. It should be used first in the expression string, or after one or more whitespace characters. If there are non-whitespace characters before the flag, the results are undefined.
Hence, fnmatch uses undefined pattern, and indeed, it fails with alternative Perl-compatible regular expression implementations (specifically, PCRE, which appear to do something like apply flag at the point of its occurrence).
components: Library (Lib)
title: fnmatch module uses undefined regular expression to perform matching
versions: Python 3.4
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce