mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-67565: Remove redundant C-contiguity checks (GH-105521)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
This commit is contained in:
parent
c84b0390c0
commit
32c37fe1ba
30 changed files with 36 additions and 464 deletions
18
Modules/clinic/_struct.c.h
generated
18
Modules/clinic/_struct.c.h
generated
|
@ -94,10 +94,6 @@ Struct_unpack(PyStructObject *self, PyObject *arg)
|
|||
if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
|
||||
_PyArg_BadArgument("unpack", "argument", "contiguous buffer", arg);
|
||||
goto exit;
|
||||
}
|
||||
return_value = Struct_unpack_impl(self, &buffer);
|
||||
|
||||
exit:
|
||||
|
@ -170,10 +166,6 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
|
|||
if (PyObject_GetBuffer(args[0], &buffer, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
|
||||
_PyArg_BadArgument("unpack_from", "argument 'buffer'", "contiguous buffer", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
|
@ -300,10 +292,6 @@ unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|||
if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
|
||||
_PyArg_BadArgument("unpack", "argument 2", "contiguous buffer", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
return_value = unpack_impl(module, s_object, &buffer);
|
||||
|
||||
exit:
|
||||
|
@ -379,10 +367,6 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
|
||||
_PyArg_BadArgument("unpack_from", "argument 'buffer'", "contiguous buffer", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
|
@ -452,4 +436,4 @@ exit:
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=1749aaf639d5c11c input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=6a20e87f9b298b14 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue