mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
This commit is contained in:
parent
65ce60aef1
commit
32d96a2b5b
49 changed files with 1677 additions and 275 deletions
10
Modules/clinic/_struct.c.h
generated
10
Modules/clinic/_struct.c.h
generated
|
|
@ -57,7 +57,11 @@ Struct_unpack(PyStructObject *self, PyObject *arg)
|
|||
PyObject *return_value = NULL;
|
||||
Py_buffer buffer = {NULL, NULL};
|
||||
|
||||
if (!PyArg_Parse(arg, "y*:unpack", &buffer)) {
|
||||
if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
|
||||
_PyArg_BadArgument("unpack", "contiguous buffer", arg);
|
||||
goto exit;
|
||||
}
|
||||
return_value = Struct_unpack_impl(self, &buffer);
|
||||
|
|
@ -166,7 +170,7 @@ calcsize(PyObject *module, PyObject *arg)
|
|||
PyStructObject *s_object = NULL;
|
||||
Py_ssize_t _return_value;
|
||||
|
||||
if (!PyArg_Parse(arg, "O&:calcsize", cache_struct_converter, &s_object)) {
|
||||
if (!cache_struct_converter(arg, &s_object)) {
|
||||
goto exit;
|
||||
}
|
||||
_return_value = calcsize_impl(module, s_object);
|
||||
|
|
@ -303,4 +307,4 @@ exit:
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a73b0453174e4b51 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=01516bea2641fe01 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue