bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)

This commit is contained in:
Serhiy Storchaka 2018-12-25 13:23:47 +02:00 committed by GitHub
parent 65ce60aef1
commit 32d96a2b5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 1677 additions and 275 deletions

View file

@ -47,7 +47,13 @@ _sre_ascii_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
if (!PyArg_Parse(arg, "i:ascii_iscased", &character)) {
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = _sre_ascii_iscased_impl(module, character);
@ -78,7 +84,13 @@ _sre_unicode_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
if (!PyArg_Parse(arg, "i:unicode_iscased", &character)) {
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = _sre_unicode_iscased_impl(module, character);
@ -109,7 +121,13 @@ _sre_ascii_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
if (!PyArg_Parse(arg, "i:ascii_tolower", &character)) {
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = _sre_ascii_tolower_impl(module, character);
@ -140,7 +158,13 @@ _sre_unicode_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
if (!PyArg_Parse(arg, "i:unicode_tolower", &character)) {
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
}
_return_value = _sre_unicode_tolower_impl(module, character);
@ -765,4 +789,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
/*[clinic end generated code: output=5edeca5ec36b5f34 input=a9049054013a1b77]*/
/*[clinic end generated code: output=7992634045212b26 input=a9049054013a1b77]*/