diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-07-20 12:53:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-20 12:53:55 (GMT) |
commit | 12f433411bba8a0cdc4f09ba34472745ae9da0d1 (patch) | |
tree | e927f56adec372fd015906082e1a9e27152ba421 /Objects/bytearrayobject.c | |
parent | e123012d79121ab543583631bb84c7fc27d06338 (diff) | |
download | cpython-12f433411bba8a0cdc4f09ba34472745ae9da0d1.zip cpython-12f433411bba8a0cdc4f09ba34472745ae9da0d1.tar.gz cpython-12f433411bba8a0cdc4f09ba34472745ae9da0d1.tar.bz2 |
bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic (GH-21535)
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 7035061..8b57fb6 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -738,13 +738,20 @@ bytearray_ass_subscript(PyByteArrayObject *self, PyObject *index, PyObject *valu } } +/*[clinic input] +bytearray.__init__ + + source as arg: object = NULL + encoding: str = NULL + errors: str = NULL + +[clinic start generated code]*/ + static int -bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) +bytearray___init___impl(PyByteArrayObject *self, PyObject *arg, + const char *encoding, const char *errors) +/*[clinic end generated code: output=4ce1304649c2f8b3 input=1141a7122eefd7b9]*/ { - static char *kwlist[] = {"source", "encoding", "errors", 0}; - PyObject *arg = NULL; - const char *encoding = NULL; - const char *errors = NULL; Py_ssize_t count; PyObject *it; PyObject *(*iternext)(PyObject *); @@ -755,11 +762,6 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) return -1; } - /* Parse arguments */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytearray", kwlist, - &arg, &encoding, &errors)) - return -1; - /* Make a quick exit if no first argument */ if (arg == NULL) { if (encoding != NULL || errors != NULL) { @@ -2354,7 +2356,7 @@ PyTypeObject PyByteArray_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)bytearray_init, /* tp_init */ + (initproc)bytearray___init__, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ PyObject_Del, /* tp_free */ |