We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d13e59c commit ec014a1Copy full SHA for ec014a1
Misc/NEWS.d/next/Library/2018-09-11-15-04-05.bpo-34636.capCmt.rst
@@ -0,0 +1,2 @@
1
+Speed up re scanning of many non-matching characters for \s \w and \d within
2
+bytes objects. (microoptimization)
Modules/_sre.c
@@ -87,13 +87,13 @@ static const char copyright[] =
87
/* search engine state */
88
89
#define SRE_IS_DIGIT(ch)\
90
- ((ch) < 128 && Py_ISDIGIT(ch))
+ ((ch) <= '9' && Py_ISDIGIT(ch))
91
#define SRE_IS_SPACE(ch)\
92
- ((ch) < 128 && Py_ISSPACE(ch))
+ ((ch) <= ' ' && Py_ISSPACE(ch))
93
#define SRE_IS_LINEBREAK(ch)\
94
((ch) == '\n')
95
#define SRE_IS_WORD(ch)\
96
- ((ch) < 128 && (Py_ISALNUM(ch) || (ch) == '_'))
+ ((ch) <= 'z' && (Py_ISALNUM(ch) || (ch) == '_'))
97
98
static unsigned int sre_lower_ascii(unsigned int ch)
99
{
0 commit comments