Commit Graph

109 Commits

Author SHA1 Message Date
Victor Stinner fb6a6596b5 Issue #28637: Reapply changeset 223731925d06
"issue28082: use IntFlag for re constants" by Ethan Furman.

The re module is not more used in the site module and so adding "import enum"
to re.py doesn't impact python_startup benchmark anymore.
2016-11-14 12:35:55 +01:00
Victor Stinner 1ec1cd161b Issue #28637: Revert issue #28082, don't import enum in re
Importing the enum module in the re module slows down Python startup by 34%
when Python is run from a virtual environment, or more generally when the re
module is imported at startup but not the enum module.
2016-11-08 00:42:46 +01:00
Raymond Hettinger 5820f3a381 Issue #28193: Use lru_cache in the re module. 2016-09-18 20:17:21 -07:00
Ethan Furman 722898065c issue28082: better name for Flag 2016-09-11 14:54:27 -07:00
Ethan Furman f93395bc51 issue28082: use IntFlag for re constants 2016-09-11 13:30:08 -07:00
Serhiy Storchaka be9a4e5c85 Issue #433028: Added support of modifier spans in regular expressions. 2016-09-10 00:57:55 +03:00
Serhiy Storchaka ccd047ea4b Removed unused imports. 2016-04-25 00:12:32 +03:00
Serhiy Storchaka 632a77e6a3 Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
Serhiy Storchaka 4eea62fd2e Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2015-02-21 10:07:35 +02:00
Benjamin Peterson 16e802f4ae merge 3.4 (#9179) 2014-11-30 11:51:16 -05:00
Benjamin Peterson 66323415c7 backout 9fcf4008b626 (#9179) for further consideration 2014-11-30 11:49:00 -05:00
Serhiy Storchaka ab14088141 Minor code clean up and improvements in the re module. 2014-11-11 21:13:28 +02:00
Serhiy Storchaka 6276b32799 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:45:17 +02:00
Serhiy Storchaka 84df7fe6a2 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:43:57 +02:00
Serhiy Storchaka 3bf7a6c1da Fixed compile error in issue #22410. The _locale module is optional. 2014-10-31 01:37:03 +02:00
Serhiy Storchaka cf7b1cadd1 Fixed compile error in issue #22410. The _locale module is optional. 2014-10-31 01:34:45 +02:00
Serhiy Storchaka 7cc0a1f7cb Issue #22410: Module level functions in the re module now cache compiled
locale-dependent regular expressions taking into account the locale.
2014-10-31 00:56:45 +02:00
Serhiy Storchaka 4659cc0756 Issue #22410: Module level functions in the re module now cache compiled
locale-dependent regular expressions taking into account the locale.
2014-10-31 00:53:49 +02:00
Serhiy Storchaka 4d75a01798 Issue #22510: Get rid of little overhead of testing re.DEBUG flag. 2014-09-29 18:13:02 +03:00
Serhiy Storchaka be4de52fb1 Removed a code for suport Python version <2.2. 2014-09-28 15:36:18 +03:00
Antoine Pitrou c49672f25e Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. 2014-02-03 21:01:35 +01:00
Antoine Pitrou d2cc743ca4 Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. 2014-02-03 20:59:59 +01:00
Serhiy Storchaka 32eddc1bbc Issue #16203: Add re.fullmatch() function and regex.fullmatch() method,
which anchor the pattern at both ends of the string to match.

Original patch by Matthew Barnett.
2013-11-23 23:20:30 +02:00
Georg Brandl daa1fa991c Back out accidentally pushed changeset b51218966201. 2013-10-13 09:32:59 +02:00
Georg Brandl 4300019e1a Add re.fullmatch() function and regex.fullmatch() method, which anchor the
pattern at both ends of the string to match.

Patch by Matthew Barnett.
Closes #16203.
2013-10-13 09:18:45 +02:00
Christian Heimes ad9c9bb5a9 Remove import functools from re module. The re module imports functools but never uses it. 2013-10-13 02:00:09 +02:00
Serhiy Storchaka 969ff72642 Issue #16564: Fixed a performance regression relative to Python 3.1 in the
caching of compiled regular expressions.
2013-03-16 22:53:48 +02:00
Serhiy Storchaka 0f606a636a Issue #16564: Fixed a performance regression relative to Python 3.1 in the
caching of compiled regular expressions.
2013-03-16 22:52:09 +02:00
Raymond Hettinger d0dbb20f5f Set cache sizes to a power-of-two 2013-02-17 01:33:37 -08:00
Ezio Melotti d68ac85e9a #14236: merge with 3.2. 2012-04-29 13:37:13 +03:00
Ezio Melotti 3899283670 #14236: fix docs for \S. 2012-04-29 13:35:55 +03:00
Ezio Melotti 660a949720 #14236: merge with 3.2. 2012-04-29 08:24:02 +03:00
Ezio Melotti e990092fd0 #14236: mention Unicode whitespace in \s documentation. 2012-04-29 08:23:25 +03:00
Georg Brandl 6aacc14e29 Merge with 3.2. 2012-03-10 09:27:30 +01:00
Georg Brandl e144c74e02 Closes #14244: add info about capturing groups and maxsplit to the docstring of re.split(). 2012-03-10 09:26:53 +01:00
Florent Xicluna aabbda5354 Merge 3.2 2011-10-28 14:52:29 +02:00
Florent Xicluna 5d1155c08e Closes #13258: Use callable() built-in in the standard library. 2011-10-28 14:45:05 +02:00
Raymond Hettinger cd9fdfd652 Issue 13227: Option to make the lru_cache() type specific (suggested by Andrew Koenig). 2011-10-20 08:57:45 -07:00
Ezio Melotti 88fdeb45ef #2650: re.escape() no longer escapes the "_". 2011-04-10 12:59:16 +03:00
Ezio Melotti 213eb96902 #2650: Merge with 3.1. 2011-03-25 14:25:36 +02:00
Ezio Melotti ebbf1e67a8 #2650: Refactor re.escape to use enumerate(). 2011-03-25 14:19:30 +02:00
Raymond Hettinger 02566ec89f Adopt more descriptive attribute names as suggested on python-dev. 2010-09-04 22:46:06 +00:00
Raymond Hettinger d9e8cc6249 Clean-up the cache patch for the re module. 2010-08-14 21:17:48 +00:00
Antoine Pitrou 3060c4573f Reapply r83877. 2010-08-13 16:27:38 +00:00
Antoine Pitrou aba74bddd6 Revert r83877 in order to fix compilation 2010-08-09 10:47:46 +00:00
Senthil Kumaran 9f347ea545 reapply the revert made in r83875
Now the _collections is statically built, the build dependencies are in proper
order and build works fine.

Commit Log from r83874:
Issue 9396.   Apply functools.lru_cache in the place of the
random flushing cache in the re module.
2010-08-09 07:30:53 +00:00
Raymond Hettinger 31022301b5 Revert 83784 adding functools.lru_cache() to the re module.
The problem is that the re module is imported by sysconfig
and re needs functools which uses collections.OrderedDict()
but the _collectionsmodule.c code is not yet constructed
at this point in the build.

The likely best solution will be to include _collections
as part of the static build before the rest of the
boot-strapping.
2010-08-09 05:56:50 +00:00
Raymond Hettinger 4f859ed9c7 Issue 9396. Apply functools.lru_cache in the place of the
random flushing cache in the re module.
2010-08-09 04:24:42 +00:00
Gregory P. Smith 5a63183a8b The default size of the re module's compiled regular expression cache has
been increased from 100 to 500 and the cache replacement policy has changed
from simply clearing the entire cache on overflow to randomly forgetting 20%
of the existing cached compiled regular expressions.  This is a performance
win for applications that use a lot of regular expressions and limits the
impact of the performance hit anytime the cache is exceeded.
2010-07-27 05:31:29 +00:00
Gregory P. Smith ccc5ae7ae1 Merged revisions 70090 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70090 | gregory.p.smith | 2009-03-01 21:13:57 -0800 (Sun, 01 Mar 2009) | 3 lines

  Adds an optional flags argument to re.split, re.sub and re.subn to be
  consistent with the other re module functions.
........
2009-03-02 05:21:55 +00:00