summaryrefslogtreecommitdiffstats
path: root/Python/clinic/import.c.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-25 11:23:47 (GMT)
committerGitHub <noreply@github.com>2018-12-25 11:23:47 (GMT)
commit32d96a2b5bc3136d45a66adbdb45fac351b520ce (patch)
treeacf51c9945f764ab103597c9cba376f154aa600d /Python/clinic/import.c.h
parent65ce60aef150776f884715b4315a10a0d6ae769e (diff)
downloadcpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.zip
cpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.tar.gz
cpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.tar.bz2
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
Diffstat (limited to 'Python/clinic/import.c.h')
-rw-r--r--Python/clinic/import.c.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 1eae8f2..d34d68f 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -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]*/