10000 gh-67565: Remove redundant C-contiguity checks (GH-105521) · python/cpython@32c37fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 32c37fe

Browse files
furkanonderStefan Krah
and
Stefan Krah
authored
gh-67565: Remove redundant C-contiguity checks (GH-105521)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
1 parent c84b039 commit 32c37fe

30 files changed

+36
-464
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove redundant C-contiguity check in :file:`getargs.c`, :mod:`binascii`, :mod:`ssl` and Argument Clinic. Patched by Stefan Krah and Furkan Onder

Modules/_blake2/clinic/blake2b_impl.c.h

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_blake2/clinic/blake2s_impl.c.h

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bufferedio.c.h

Lines changed: 1 addition & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/bytesio.c.h

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/fileio.c.h

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_io/clinic/winconsoleio.c.h

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_multiprocessing/clinic/multiprocessing.c.h

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/clinic/blob.c.h

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_sqlite/clinic/connection.c.h

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_ssl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4133,7 +4133,8 @@ _ssl__SSLContext_load_verify_locations_impl(PySSLContext *self,
41334133
if (PyObject_GetBuffer(cadata, &buf, PyBUF_SIMPLE)) {
41344134
goto error;
41354135
}
4136-
if (!PyBuffer_IsContiguous(&buf, 'C') || buf.ndim > 1) {
4136+
assert(PyBuffer_IsContiguous(&buf, 'C'));
4137+
if (buf.ndim > 1) {
41374138
PyBuffer_Release(&buf);
41384139
PyErr_SetString(PyExc_TypeError,
41394140
"cadata should be a contiguous buffer with "

Modules/binascii.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,7 @@ ascii_buffer_converter(PyObject *arg, Py_buffer *buf)
185185
"not '%.100s'", Py_TYPE(arg)->tp_name);
186186
return 0;
187187
}
188-
if (!PyBuffer_IsContiguous(buf, 'C')) {
189-
PyErr_Format(PyExc_TypeError,
190-
"argument should be a contiguous buffer, "
191-
"not '%.100s'", Py_TYPE(arg)->tp_name);
192-
PyBuffer_Release(buf);
193-
return 0;
194-
}
188+
assert(PyBuffer_IsContiguous(buf, 'C'));
195189
return Py_CLEANUP_SUPPORTED;
196190
}
197191

Modules/cjkcodecs/clinic/multibytecodec.c.h

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_bz2module.c.h

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0