Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ re
(Contributed by Serhiy Storchaka in :gh:`152033` and Pieter Eendebak in
:gh:`152056`.)

* A greedy repeat is now compiled as possessive when the repeated characters
and the characters that can follow it are provably disjoint (for example
``\d+\.`` is compiled as if it were ``\d++\.``), which makes failing and
heavily backtracking matches severalfold faster.
(Contributed by Serhiy Storchaka in :gh:`153044`.)

module_name
-----------

Expand Down
2 changes: 1 addition & 1 deletion Lib/re/_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _code(p, flags):
flags = p.state.flags | flags

# run the optimizer passes over the parsed pattern
optimize(p)
optimize(p, flags)

code = []

Expand Down
Loading
Loading