mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). (#4846)
This commit is contained in:
parent
0cc99c8cd7
commit
fbb490fd2f
6 changed files with 35 additions and 25 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue