bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). (#4846)

This commit is contained in:
Serhiy Storchaka 2018-01-04 11:06:13 +02:00 committed by GitHub
parent 0cc99c8cd7
commit fbb490fd2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 25 deletions

View file

@ -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;
}