Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f0d59f

Browse files
sir-sigurdserhiy-storchaka
authored andcommitted
Simplified implementation of _sre.ascii_iscased(). (GH-9097)
1 parent 731ff68 commit 7f0d59f

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

Modules/_sre.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ static unsigned int sre_lower_ascii(unsigned int ch)
100100
return ((ch) < 128 ? Py_TOLOWER(ch) : ch);
101101
}
102102

103-
static unsigned int sre_upper_ascii(unsigned int ch)
104-
{
105-
return ((ch) < 128 ? Py_TOUPPER(ch) : ch);
106-
}
107-
108103
/* locale-specific character predicates */
109104
/* !(c & ~N) == (c < N+1) for any unsigned c, this avoids
110105
* warnings when c's type supports only numbers < N+1 */
@@ -293,7 +288,7 @@ _sre_ascii_iscased_impl(PyObject *module, int character)
293288
/*[clinic end generated code: output=4f454b630fbd19a2 input=9f0bd952812c7ed3]*/
294289
{
295290
unsigned int ch = (unsigned int)character;
296-
return ch != sre_lower_ascii(ch) || ch != sre_upper_ascii(ch);
291+
return ch < 128 && Py_ISALPHA(ch);
297292
}
298293

299294
/*[clinic input]

0 commit comments

Comments
 (0)