bpo-30277: Replace _sre.getlower() with _sre.ascii_tolower() and _sre.unicode_tolower(). (#1468)

This commit is contained in:
Serhiy Storchaka 2017-05-05 10:42:46 +03:00 committed by GitHub
parent 76a3e51a40
commit 7186cc29be
4 changed files with 82 additions and 43 deletions

View file

@ -274,25 +274,35 @@ _sre_getcodesize_impl(PyObject *module)
}
/*[clinic input]
_sre.getlower -> int
_sre.ascii_tolower -> int
character: int
flags: int
/
[clinic start generated code]*/
static int
_sre_getlower_impl(PyObject *module, int character, int flags)
/*[clinic end generated code: output=47eebc4c1214feb5 input=087d2f1c44bbca6f]*/
_sre_ascii_tolower_impl(PyObject *module, int character)
/*[clinic end generated code: output=228294ed6ff2a612 input=272c609b5b61f136]*/
{
if (flags & SRE_FLAG_LOCALE)
return sre_lower_locale(character);
if (flags & SRE_FLAG_UNICODE)
return sre_lower_unicode(character);
return sre_lower(character);
}
/*[clinic input]
_sre.unicode_tolower -> int
character: int
/
[clinic start generated code]*/
static int
_sre_unicode_tolower_impl(PyObject *module, int character)
/*[clinic end generated code: output=6422272d7d7fee65 input=91d708c5f3c2045a]*/
{
return sre_lower_unicode(character);
}
LOCAL(void)
state_reset(SRE_STATE* state)
{
@ -2740,7 +2750,8 @@ static PyTypeObject Scanner_Type = {
static PyMethodDef _functions[] = {
_SRE_COMPILE_METHODDEF
_SRE_GETCODESIZE_METHODDEF
_SRE_GETLOWER_METHODDEF
_SRE_ASCII_TOLOWER_METHODDEF
_SRE_UNICODE_TOLOWER_METHODDEF
{NULL, NULL}
};