diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-01-04 09:06:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 09:06:13 (GMT) |
commit | fbb490fd2f38bd817d99c20c05121ad0168a38ee (patch) | |
tree | 417d39bc824e6e62503f94033dbd2b37a8b5545b /Modules | |
parent | 0cc99c8cd70d422e4b345837a907db30e9180ab9 (diff) | |
download | cpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.zip cpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.tar.gz cpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.tar.bz2 |
bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). (#4846)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 68fc523..b6be6f6 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -955,7 +955,7 @@ _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string, } n = n + 1; - state.must_advance = 1; + state.must_advance = (state.ptr == state.start); last = state.start = state.ptr; } @@ -1109,7 +1109,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, i = e; n = n + 1; - state.must_advance = 1; + state.must_advance = (state.ptr == state.start); state.start = state.ptr; } |