[issue31580] Defer compiling regular expressions

Serhiy Storchaka report at bugs.python.org
Tue Sep 26 01:07:04 EDT 2017


Serhiy Storchaka added the comment:

lru_cache() is not used for reasons. The patch makes using cached patterns slower by adding an overhead of 4 additional checks. It makes resolving attributes of a deferred patterns slower. All this slows down a straight call to re.search(pattern, s).

Errors in regular expression now raised only on first use of the pattern. This is a drawback from educational and debugging points of view.

The patch also breaks warnings emitted during compiling regular expressions. Now they report wrong source line and use wrong line for caching in case of -Wonce.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31580>
_______________________________________


More information about the Python-bugs-list mailing list