diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-05-05 07:42:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-05 07:42:46 (GMT) |
commit | 7186cc29be352bed6f1110873283d073fd0643e4 (patch) | |
tree | 62b9aa53a22754f7e95cbde603643b8d33df6d07 /Modules/clinic | |
parent | 76a3e51a403bc84ed536921866c86dd7d07aaa7e (diff) | |
download | cpython-7186cc29be352bed6f1110873283d073fd0643e4.zip cpython-7186cc29be352bed6f1110873283d073fd0643e4.tar.gz cpython-7186cc29be352bed6f1110873283d073fd0643e4.tar.bz2 |
bpo-30277: Replace _sre.getlower() with _sre.ascii_tolower() and _sre.unicode_tolower(). (#1468)
Diffstat (limited to 'Modules/clinic')
-rw-r--r-- | Modules/clinic/_sre.c.h | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h index 5278323..8056eda 100644 --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -29,34 +29,59 @@ exit: return return_value; } -PyDoc_STRVAR(_sre_getlower__doc__, -"getlower($module, character, flags, /)\n" +PyDoc_STRVAR(_sre_ascii_tolower__doc__, +"ascii_tolower($module, character, /)\n" "--\n" "\n"); -#define _SRE_GETLOWER_METHODDEF \ - {"getlower", (PyCFunction)_sre_getlower, METH_FASTCALL, _sre_getlower__doc__}, +#define _SRE_ASCII_TOLOWER_METHODDEF \ + {"ascii_tolower", (PyCFunction)_sre_ascii_tolower, METH_O, _sre_ascii_tolower__doc__}, static int -_sre_getlower_impl(PyObject *module, int character, int flags); +_sre_ascii_tolower_impl(PyObject *module, int character); static PyObject * -_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +_sre_ascii_tolower(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; int character; - int flags; int _return_value; - if (!_PyArg_ParseStack(args, nargs, "ii:getlower", - &character, &flags)) { + if (!PyArg_Parse(arg, "i:ascii_tolower", &character)) { + goto exit; + } + _return_value = _sre_ascii_tolower_impl(module, character); + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; } + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(_sre_unicode_tolower__doc__, +"unicode_tolower($module, character, /)\n" +"--\n" +"\n"); + +#define _SRE_UNICODE_TOLOWER_METHODDEF \ + {"unicode_tolower", (PyCFunction)_sre_unicode_tolower, METH_O, _sre_unicode_tolower__doc__}, + +static int +_sre_unicode_tolower_impl(PyObject *module, int character); + +static PyObject * +_sre_unicode_tolower(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int character; + int _return_value; - if (!_PyArg_NoStackKeywords("getlower", kwnames)) { + if (!PyArg_Parse(arg, "i:unicode_tolower", &character)) { goto exit; } - _return_value = _sre_getlower_impl(module, character, flags); + _return_value = _sre_unicode_tolower_impl(module, character); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; } @@ -690,4 +715,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored)) { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=e6dab3ba8864da9e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=811e67d7f8f5052e input=a9049054013a1b77]*/ |