Commit Graph

36 Commits

Author SHA1 Message Date
Serhiy Storchaka 0902c3d8ed
gh-89973: Fix re.error in the fnmatch module. (GH-93072)
Character ranges with upper bound less that lower bound (e.g. [c-a])
are now interpreted as empty ranges, for compatibility with other glob
pattern implementations. Previously it was re.error.
2022-06-05 11:46:29 +03:00
Tim Peters 5c3201e146
bpo-47080: Use atomic groups to simplify fnmatch (GH-32029)
Use re's new atomic groups to greatly simplify the construction of worst-case linear-time patterns.
2022-03-21 12:49:43 -05:00
andrei kulakov b39eea06d1
bpo-42799: fnmatch module: bump up size of lru_cache for patterns (GH-27084) 2021-07-15 12:53:26 +02:00
Andre Delfino e8d2264210
bpo-36769: Document that fnmatch.filter supports any kind of iterable (#13039) 2020-12-18 20:10:20 +01:00
Tim Peters b1b4c790e7
bpo-40480: restore ability to join fnmatch.translate() results (GH-20049)
In translate(), generate unique group names across calls.

The restores the undocumented ability to get a valid regexp
by joining multiple translate() results via `|`.
2020-05-11 21:19:20 -05:00
Tim Peters b9c46a2c2d
bpo-40480 "fnmatch" exponential execution time (GH-19908)
bpo-40480:  create different regexps in the presence of multiple `*`
patterns to prevent fnmatch() from taking exponential time.
2020-05-05 21:28:24 -05:00
Serhiy Storchaka 23cdbfa744
bpo-32775: Fix regular expression warnings in fnmatch. (#5583)
fnmatch.translate() no longer produces patterns which contain set
operations.

Sets starting with '[' or containing '--', '&&', '~~' or '||' will
be interpreted differently in regular expressions in future versions.
Currently they emit warnings. fnmatch.translate() now avoids producing
patterns containing such sets by accident.
2018-02-09 13:30:19 +02:00
Serhiy Storchaka bd48d27944 Issue #22493: Inline flags now should be used only at the start of the
regular expression.  Deprecation warning is emitted if uses them in the
middle of the regular expression.
2016-09-11 12:50:02 +03:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Raymond Hettinger d0dbb20f5f Set cache sizes to a power-of-two 2013-02-17 01:33:37 -08:00
Antoine Pitrou 682ca1e6e2 Fix BytesWarnings in fnmatch 2011-11-08 18:39:15 +01:00
Raymond Hettinger ded203f7c9 Bytes are already distinct from text, so typed=True isn't necessary. 2011-10-20 09:42:05 -07:00
Raymond Hettinger db84803562 Simplify calls in fnmatch. 2011-10-20 09:22:10 -07:00
Antoine Pitrou 6fdb74f0ae Re-apply r83871. 2010-08-13 16:26:40 +00:00
Antoine Pitrou f14c263280 Also temporarily revert r83871, to fix compilation on buildbots 2010-08-09 12:47:33 +00:00
Raymond Hettinger 5b0c1e07ca Issue 7846: fnmatch cache can grow without bound
Updated to solution to use the functools.lru_cache().
Restores the API so that purge() is not needed
(because the cache never gets big).
2010-08-09 02:07:15 +00:00
Brett Cannon cc14320159 Make fnmatch be more PEP 8 compliant.
Partially closes issue 9356. Thanks to Brian Brazil for the patch.
2010-07-23 16:22:25 +00:00
R. David Murray 0425a8ea72 Fix 'refleak' introduced by fnmatch cache purge tests.
This introduces a 'purge' function for the fnmatch module analogous
to the 'purge' function in the re module.
2010-07-10 13:52:13 +00:00
R. David Murray ea340a317a 7846: limit fnmatch pattern cache to _MAXCACHE=100 entries.
Patch by Andrew Clegg.
2010-07-09 12:23:21 +00:00
Gregory P. Smith 01099707db Merged revisions 74475 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74475 | gregory.p.smith | 2009-08-16 11:52:58 -0700 (Sun, 16 Aug 2009) | 2 lines

  Issue 6665: Fix fnmatch to properly match filenames with newlines in them.
........
2009-08-16 18:58:46 +00:00
Guido van Rossum 3f2291f802 Change fnmatch.py to use separate caches for str and bytes keys.
This is necessary to pass the tests with -bb.
2008-10-03 16:38:30 +00:00
Guido van Rossum f0af3e30db Issue #3187: Better support for "undecodable" filenames. Code by Victor
Stinner, with small tweaks by GvR.
2008-10-02 18:55:37 +00:00
Raymond Hettinger 4a4296ec29 SF patch #765238: fix fnmatch.__all__
(Contributed by George Yoshida.)
2003-07-13 16:06:26 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Martin v. Löwis b5d4d2a7d5 Patch #409973: Speedup glob.glob, add fnmatch.filter. 2001-06-06 06:24:38 +00:00
Fred Drake 46d9fda008 Donovan Baarda <abo@users.sourceforge.net>:
Patch to make "\" in a character group work properly.

This closes SF bug #409651.
2001-03-21 18:05:48 +00:00
Skip Montanaro eccd02a40d more __all__ updates 2001-01-20 23:34:12 +00:00
Tim Peters 88869f9787 Whitespace normalization. 2001-01-14 23:36:06 +00:00
Jeremy Hylton a05e293a21 typos fixed by Rob Hooft 2000-06-28 14:48:01 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Guido van Rossum 7e4b2def34 changes for the Mac 1995-01-27 02:41:45 +00:00
Guido van Rossum 3ec6c1d401 Get rid of debug print statement. 1992-01-14 18:27:26 +00:00
Guido van Rossum 05e5219f53 Rewritten using regex. 1992-01-12 23:29:29 +00:00
Guido van Rossum bdfcfccbe5 New == syntax 1992-01-01 19:35:13 +00:00
Guido van Rossum fc61383fad Support [...] ranges. Also [!...] for negated ranges, SYSV shell style. 1991-04-07 13:40:02 +00:00
Guido van Rossum 762c39e9d2 Initial revision 1991-01-01 18:11:14 +00:00