summaryrefslogtreecommitdiff
path: root/Objects/clinic/bytesobject.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/clinic/bytesobject.c.h')
-rw-r--r--Objects/clinic/bytesobject.c.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index 193d534fdd..1345b644d1 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -66,7 +66,11 @@ bytes_partition(PyBytesObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:partition", &sep)) {
+ if (PyObject_GetBuffer(arg, &sep, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&sep, 'C')) {
+ _PyArg_BadArgument("partition", "contiguous buffer", arg);
goto exit;
}
return_value = bytes_partition_impl(self, &sep);
@@ -105,7 +109,11 @@ bytes_rpartition(PyBytesObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:rpartition", &sep)) {
+ if (PyObject_GetBuffer(arg, &sep, PyBUF_SIMPLE) != 0) {
+ goto exit;
+ }
+ if (!PyBuffer_IsContiguous(&sep, 'C')) {
+ _PyArg_BadArgument("rpartition", "contiguous buffer", arg);
goto exit;
}
return_value = bytes_rpartition_impl(self, &sep);
@@ -491,12 +499,17 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
PyObject *string;
- if (!PyArg_Parse(arg, "U:fromhex", &string)) {
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("fromhex", "str", arg);
+ goto exit;
+ }
+ if (PyUnicode_READY(arg) == -1) {
goto exit;
}
+ string = arg;
return_value = bytes_fromhex_impl(type, string);
exit:
return return_value;
}
-/*[clinic end generated code: output=07b33ac65362301b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=dc9aa04f0007ab11 input=a9049054013a1b77]*/