mirror of
https://github.com/python/cpython.git
synced 2025-10-28 09:10:36 +00:00
gh-124130: Fix a bug in matching regular expression \B in empty string (GH-127007)
This commit is contained in:
parent
8d16919a06
commit
a3711d1541
5 changed files with 15 additions and 25 deletions
|
|
@ -42,8 +42,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return ((void*) ptr == state->end);
|
||||
|
||||
case SRE_AT_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
@ -51,8 +49,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return thisp != thatp;
|
||||
|
||||
case SRE_AT_NON_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
@ -60,8 +56,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return thisp == thatp;
|
||||
|
||||
case SRE_AT_LOC_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_LOC_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
@ -69,8 +63,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return thisp != thatp;
|
||||
|
||||
case SRE_AT_LOC_NON_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_LOC_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
@ -78,8 +70,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return thisp == thatp;
|
||||
|
||||
case SRE_AT_UNI_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_UNI_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
@ -87,8 +77,6 @@ SRE(at)(SRE_STATE* state, const SRE_CHAR* ptr, SRE_CODE at)
|
|||
return thisp != thatp;
|
||||
|
||||
case SRE_AT_UNI_NON_BOUNDARY:
|
||||
if (state->beginning == state->end)
|
||||
return 0;
|
||||
thatp = ((void*) ptr > state->beginning) ?
|
||||
SRE_UNI_IS_WORD((int) ptr[-1]) : 0;
|
||||
thisp = ((void*) ptr < state->end) ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue