diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-25 11:23:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-25 11:23:47 (GMT) |
commit | 32d96a2b5bc3136d45a66adbdb45fac351b520ce (patch) | |
tree | acf51c9945f764ab103597c9cba376f154aa600d /Modules/clinic/gcmodule.c.h | |
parent | 65ce60aef150776f884715b4315a10a0d6ae769e (diff) | |
download | cpython-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 'Modules/clinic/gcmodule.c.h')
-rw-r--r-- | Modules/clinic/gcmodule.c.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h index 1c4be66..4fd2ea0 100644 --- a/Modules/clinic/gcmodule.c.h +++ b/Modules/clinic/gcmodule.c.h @@ -136,7 +136,13 @@ gc_set_debug(PyObject *module, PyObject *arg) PyObject *return_value = NULL; int flags; - if (!PyArg_Parse(arg, "i:set_debug", &flags)) { + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + flags = _PyLong_AsInt(arg); + if (flags == -1 && PyErr_Occurred()) { goto exit; } return_value = gc_set_debug_impl(module, flags); @@ -325,4 +331,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored)) exit: return return_value; } -/*[clinic end generated code: output=ba67a1ab58780485 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5aa5fdc259503d5f input=a9049054013a1b77]*/ |