summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2018-09-12 17:49:09 +0500
committerSerhiy Storchaka <storchaka@gmail.com>2018-09-12 15:49:09 +0300
commit7f0d59f3a83cf1a98398b8e5bdfb97c7a71216bd (patch)
tree9efcd976a9b101ef07815aea8b225091a9dbaad3
parent731ff68eeef58babdf2b32dc9a73b141760c2be9 (diff)
downloadcpython-git-7f0d59f3a83cf1a98398b8e5bdfb97c7a71216bd.tar.gz
Simplified implementation of _sre.ascii_iscased(). (GH-9097)
-rw-r--r--Modules/_sre.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 483cf5e9ff..c3509796f3 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -100,11 +100,6 @@ static unsigned int sre_lower_ascii(unsigned int ch)
return ((ch) < 128 ? Py_TOLOWER(ch) : ch);
}
-static unsigned int sre_upper_ascii(unsigned int ch)
-{
- return ((ch) < 128 ? Py_TOUPPER(ch) : ch);
-}
-
/* locale-specific character predicates */
/* !(c & ~N) == (c < N+1) for any unsigned c, this avoids
* warnings when c's type supports only numbers < N+1 */
@@ -293,7 +288,7 @@ _sre_ascii_iscased_impl(PyObject *module, int character)
/*[clinic end generated code: output=4f454b630fbd19a2 input=9f0bd952812c7ed3]*/
{
unsigned int ch = (unsigned int)character;
- return ch != sre_lower_ascii(ch) || ch != sre_upper_ascii(ch);
+ return ch < 128 && Py_ISALPHA(ch);
}
/*[clinic input]