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

@ -143,9 +143,14 @@ _imp_init_frozen(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name;
if (!PyArg_Parse(arg, "U:init_frozen", &name)) {
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("init_frozen", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_init_frozen_impl(module, name);
exit:
@ -170,9 +175,14 @@ _imp_get_frozen_object(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name;
if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) {
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("get_frozen_object", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_get_frozen_object_impl(module, name);
exit:
@ -197,9 +207,14 @@ _imp_is_frozen_package(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name;
if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) {
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("is_frozen_package", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_frozen_package_impl(module, name);
exit:
@ -224,9 +239,14 @@ _imp_is_builtin(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name;
if (!PyArg_Parse(arg, "U:is_builtin", &name)) {
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("is_builtin", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_builtin_impl(module, name);
exit:
@ -251,9 +271,14 @@ _imp_is_frozen(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
PyObject *name;
if (!PyArg_Parse(arg, "U:is_frozen", &name)) {
if (!PyUnicode_Check(arg)) {
_PyArg_BadArgument("is_frozen", "str", arg);
goto exit;
}
if (PyUnicode_READY(arg) == -1) {
goto exit;
}
name = arg;
return_value = _imp_is_frozen_impl(module, name);
exit:
@ -396,4 +421,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
/*[clinic end generated code: output=ad747b76e105fff2 input=a9049054013a1b77]*/
/*[clinic end generated code: output=d8be58c9541122f1 input=a9049054013a1b77]*/