Skip to content

Commits on Oct 23, 2022

  1. gh-91524: Speed up the regular expression substitution (#91525)

    Functions re.sub() and re.subn() and corresponding re.Pattern methods
    are now 2-3 times faster for replacement strings containing group references.
    
    Closes #91524
    
    Primarily authored by serhiy-storchaka Serhiy Storchaka
    Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
    serhiy-storchaka committed Oct 23, 2022

Commits on Jun 17, 2022

  1. gh-91404: Revert "bpo-23689: re module, fix memory leak when a match …

    …is terminated by a signal or allocation failure (GH-32283) (#93882)
    
    Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)"
    
    This reverts commit 6e3eee5.
    
    Manual fixups to increase the MAGIC number and to handle conflicts with
    a couple of changes that landed after that.
    
    Thanks for reviews by Ma Lin and Serhiy Storchaka.
    gpshead committed Jun 17, 2022

Commits on May 25, 2022

  1. gh-92728: Restore re.template, but deprecate it (GH-93161)

    Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)"
    
    This reverts commit b09184b.
    hroncok committed May 25, 2022

Commits on May 8, 2022

  1. gh-91760: More strict rules for numerical group references and group …

    …names in RE (GH-91792)
    
    Only sequence of ASCII digits is now accepted as a numerical reference.
    The group name in bytes patterns and replacement strings can now only
    contain ASCII letters and digits and underscore.
    serhiy-storchaka committed May 8, 2022

Commits on Apr 30, 2022

  1. gh-91760: Deprecate group names and numbers which will be invalid in …

    …future (GH-91794)
    
    Only sequence of ASCII digits will be accepted as a numerical reference.
    The group name in bytes patterns and replacement strings could only
    contain ASCII letters and digits and underscore.
    serhiy-storchaka committed Apr 30, 2022
  2. gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)

    Previously, pickling did not fail, but the result could not be unpickled.
    serhiy-storchaka committed Apr 30, 2022

Commits on Apr 26, 2022

  1. gh-91870: Remove unsupported SRE opcode CALL (GH-91872)

    It was initially added to support atomic groups, but that
    support was never fully implemented, and CALL was only left
    in the compiler, but not interpreter and parser.
    
    ATOMIC_GROUP is now used to support atomic groups.
    serhiy-storchaka committed Apr 26, 2022

Commits on Apr 23, 2022

  1. RE: Pre-split the list of opcode names (GH-91859)

    1. It makes them interned.
    2. It allows to add comments to individual opcodes.
    serhiy-storchaka committed Apr 23, 2022

Commits on Apr 22, 2022

  1. gh-91575: Add a script for generating data for case-insensitive match…

    …ing in re (GH-91660)
    
    Also test that all extra cases are in BMP.
    serhiy-storchaka committed Apr 22, 2022
  2. gh-91700: Validate the group number in conditional expression in RE (G…

    …H-91702)
    
    In expression (?(group)...) an appropriate re.error is now
    raised if the group number refers to not defined group.
    
    Previously it raised RuntimeError: invalid SRE code.
    serhiy-storchaka committed Apr 22, 2022
  3. gh-90568: Fix exception type for \N with a named sequence in RE (GH-9…

    …1665)
    
    re.error is now raised instead of TypeError.
    serhiy-storchaka committed Apr 22, 2022

Commits on Apr 12, 2022

  1. bpo-47152: Automatically regenerate sre_constants.h (GH-91439)

    * Move the code for generating Modules/_sre/sre_constants.h from
      Lib/re/_constants.py into a separate script
      Tools/scripts/generate_sre_constants.py.
    * Add target `regen-sre` in the makefile.
    * Make target `regen-all` depending on `regen-sre`.
    serhiy-storchaka committed Apr 12, 2022

Commits on Apr 3, 2022

  1. bpo-23689: re module, fix memory leak when a match is terminated by a…

    … signal or memory allocation failure (GH-32283)
    animalize committed Apr 3, 2022

Commits on Apr 2, 2022

  1. bpo-47152: Convert the re module into a package (GH-32177)

    The sre_* modules are now deprecated.
    serhiy-storchaka committed Apr 2, 2022