summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorFurkan Onder <furkanonder@protonmail.com>2023-10-23 09:54:46 (GMT)
committerGitHub <noreply@github.com>2023-10-23 09:54:46 (GMT)
commit32c37fe1ba708b8290cfa971e130bcfc29f1ead3 (patch)
treecb2ea772b12098a174426a058203f6683a14d8e2 /Modules/_io
parentc84b0390c053446b746b65ec82755918955e79e0 (diff)
downloadcpython-32c37fe1ba708b8290cfa971e130bcfc29f1ead3.zip
cpython-32c37fe1ba708b8290cfa971e130bcfc29f1ead3.tar.gz
cpython-32c37fe1ba708b8290cfa971e130bcfc29f1ead3.tar.bz2
gh-67565: Remove redundant C-contiguity checks (GH-105521)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/clinic/bufferedio.c.h22
-rw-r--r--Modules/_io/clinic/bytesio.c.h6
-rw-r--r--Modules/_io/clinic/fileio.c.h10
-rw-r--r--Modules/_io/clinic/winconsoleio.c.h10
4 files changed, 4 insertions, 44 deletions
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h
index 83c97ae..f6ac269 100644
--- a/Modules/_io/clinic/bufferedio.c.h
+++ b/Modules/_io/clinic/bufferedio.c.h
@@ -30,10 +30,6 @@ _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io__BufferedIOBase_readinto_impl(self, &buffer);
exit:
@@ -66,10 +62,6 @@ _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg)
_PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer);
exit:
@@ -592,10 +584,6 @@ _io__Buffered_readinto(buffered *self, PyObject *arg)
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io__Buffered_readinto_impl(self, &buffer);
exit:
@@ -628,10 +616,6 @@ _io__Buffered_readinto1(buffered *self, PyObject *arg)
_PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io__Buffered_readinto1_impl(self, &buffer);
exit:
@@ -945,10 +929,6 @@ _io_BufferedWriter_write(buffered *self, PyObject *arg)
if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io_BufferedWriter_write_impl(self, &buffer);
exit:
@@ -1095,4 +1075,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=b83f65fad0cd5fb6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=090e70253e35fc22 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h
index cf16335..37023e4 100644
--- a/Modules/_io/clinic/bytesio.c.h
+++ b/Modules/_io/clinic/bytesio.c.h
@@ -332,10 +332,6 @@ _io_BytesIO_readinto(bytesio *self, PyObject *arg)
_PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
- goto exit;
- }
return_value = _io_BytesIO_readinto_impl(self, &buffer);
exit:
@@ -538,4 +534,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=27333725edff70a0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2be0e05a8871b7e2 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h
index 748bc9c..cf3ba28 100644
--- a/Modules/_io/clinic/fileio.c.h
+++ b/Modules/_io/clinic/fileio.c.h
@@ -249,10 +249,6 @@ _io_FileIO_readinto(fileio *self, PyTypeObject *cls, PyObject *const *args, Py_s
_PyArg_BadArgument("readinto", "argument 1", "read-write bytes-like object", args[0]);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument 1", "contiguous buffer", args[0]);
- goto exit;
- }
return_value = _io_FileIO_readinto_impl(self, cls, &buffer);
exit:
@@ -381,10 +377,6 @@ _io_FileIO_write(fileio *self, PyTypeObject *cls, PyObject *const *args, Py_ssiz
if (PyObject_GetBuffer(args[0], &b, PyBUF_SIMPLE) != 0) {
goto exit;
}
- if (!PyBuffer_IsContiguous(&b, 'C')) {
- _PyArg_BadArgument("write", "argument 1", "contiguous buffer", args[0]);
- goto exit;
- }
return_value = _io_FileIO_write_impl(self, cls, &b);
exit:
@@ -536,4 +528,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
-/*[clinic end generated code: output=10838003d15e7b3d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1c0f4a36f76b0c6a input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/winconsoleio.c.h b/Modules/_io/clinic/winconsoleio.c.h
index f40786a..6cab295 100644
--- a/Modules/_io/clinic/winconsoleio.c.h
+++ b/Modules/_io/clinic/winconsoleio.c.h
@@ -247,10 +247,6 @@ _io__WindowsConsoleIO_readinto(winconsoleio *self, PyTypeObject *cls, PyObject *
_PyArg_BadArgument("readinto", "argument 1", "read-write bytes-like object", args[0]);
goto exit;
}
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument 1", "contiguous buffer", args[0]);
- goto exit;
- }
return_value = _io__WindowsConsoleIO_readinto_impl(self, cls, &buffer);
exit:
@@ -391,10 +387,6 @@ _io__WindowsConsoleIO_write(winconsoleio *self, PyTypeObject *cls, PyObject *con
if (PyObject_GetBuffer(args[0], &b, PyBUF_SIMPLE) != 0) {
goto exit;
}
- if (!PyBuffer_IsContiguous(&b, 'C')) {
- _PyArg_BadArgument("write", "argument 1", "contiguous buffer", args[0]);
- goto exit;
- }
return_value = _io__WindowsConsoleIO_write_impl(self, cls, &b);
exit:
@@ -465,4 +457,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
-/*[clinic end generated code: output=2debef253fa1ab90 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=04108fc26b187386 input=a9049054013a1b77]*/