diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-25 13:23:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-25 13:23:47 +0200 |
commit | 32d96a2b5bc3136d45a66adbdb45fac351b520ce (patch) | |
tree | acf51c9945f764ab103597c9cba376f154aa600d /Python/clinic/marshal.c.h | |
parent | 65ce60aef150776f884715b4315a10a0d6ae769e (diff) | |
download | cpython-git-32d96a2b5bc3136d45a66adbdb45fac351b520ce.tar.gz |
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
Diffstat (limited to 'Python/clinic/marshal.c.h')
-rw-r--r-- | Python/clinic/marshal.c.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h index 0df4935893..516a31582c 100644 --- a/Python/clinic/marshal.c.h +++ b/Python/clinic/marshal.c.h @@ -121,7 +121,11 @@ marshal_loads(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer bytes = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:loads", &bytes)) { + if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&bytes, 'C')) { + _PyArg_BadArgument("loads", "contiguous buffer", arg); goto exit; } return_value = marshal_loads_impl(module, &bytes); @@ -134,4 +138,4 @@ exit: return return_value; } -/*[clinic end generated code: output=cbb6128201bee7e0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8262e7e6c8cbc1ef input=a9049054013a1b77]*/ |