Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Speed up re scanning of many non-matching characters for \s \w and \d within
bytes objects. (microoptimization)
6 changes: 3 additions & 3 deletions Modules/_sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ static const char copyright[] =
/* search engine state */

#define SRE_IS_DIGIT(ch)\
((ch) < 128 && Py_ISDIGIT(ch))
((ch) <= '9' && Py_ISDIGIT(ch))
#define SRE_IS_SPACE(ch)\
((ch) < 128 && Py_ISSPACE(ch))
((ch) <= ' ' && Py_ISSPACE(ch))
#define SRE_IS_LINEBREAK(ch)\
((ch) == '\n')
#define SRE_IS_WORD(ch)\
((ch) < 128 && (Py_ISALNUM(ch) || (ch) == '_'))
((ch) <= 'z' && (Py_ISALNUM(ch) || (ch) == '_'))

static unsigned int sre_lower_ascii(unsigned int ch)
{
Expand Down