diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h')
-rw-r--r-- | contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h | 816 |
1 files changed, 408 insertions, 408 deletions
diff --git a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h index cf81df4af6..892d9ba134 100644 --- a/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h +++ b/contrib/tools/python3/src/Objects/clinic/unicodeobject.c.h @@ -71,7 +71,7 @@ PyDoc_STRVAR(unicode_center__doc__, "Padding is done using the specified fill character (default is a space)."); #define UNICODE_CENTER_METHODDEF \ - {"center", (PyCFunction)(void(*)(void))unicode_center, METH_FASTCALL, unicode_center__doc__}, + {"center", (PyCFunction)(void(*)(void))unicode_center, METH_FASTCALL, unicode_center__doc__}, static PyObject * unicode_center_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar); @@ -83,33 +83,33 @@ unicode_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs) Py_ssize_t width; Py_UCS4 fillchar = ' '; - if (!_PyArg_CheckPositional("center", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("center", nargs, 1, 2)) { goto exit; } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[0]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - width = ival; - } - if (nargs < 2) { - goto skip_optional; - } - if (!convert_uc(args[1], &fillchar)) { - goto exit; - } -skip_optional: + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[0]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + width = ival; + } + if (nargs < 2) { + goto skip_optional; + } + if (!convert_uc(args[1], &fillchar)) { + goto exit; + } +skip_optional: return_value = unicode_center_impl(self, width, fillchar); exit: @@ -132,7 +132,7 @@ PyDoc_STRVAR(unicode_encode__doc__, " codecs.register_error that can handle UnicodeEncodeErrors."); #define UNICODE_ENCODE_METHODDEF \ - {"encode", (PyCFunction)(void(*)(void))unicode_encode, METH_FASTCALL|METH_KEYWORDS, unicode_encode__doc__}, + {"encode", (PyCFunction)(void(*)(void))unicode_encode, METH_FASTCALL|METH_KEYWORDS, unicode_encode__doc__}, static PyObject * unicode_encode_impl(PyObject *self, const char *encoding, const char *errors); @@ -142,51 +142,51 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject { PyObject *return_value = NULL; static const char * const _keywords[] = {"encoding", "errors", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; + static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; const char *encoding = NULL; const char *errors = NULL; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); + if (!args) { goto exit; } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[0]) { - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]); - goto exit; - } - Py_ssize_t encoding_length; - encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length); - if (encoding == NULL) { - goto exit; - } - if (strlen(encoding) != (size_t)encoding_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]); - goto exit; - } - Py_ssize_t errors_length; - errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length); - if (errors == NULL) { - goto exit; - } - if (strlen(errors) != (size_t)errors_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } -skip_optional_pos: + if (!noptargs) { + goto skip_optional_pos; + } + if (args[0]) { + if (!PyUnicode_Check(args[0])) { + _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[0]); + goto exit; + } + Py_ssize_t encoding_length; + encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length); + if (encoding == NULL) { + goto exit; + } + if (strlen(encoding) != (size_t)encoding_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("encode", "argument 'errors'", "str", args[1]); + goto exit; + } + Py_ssize_t errors_length; + errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length); + if (errors == NULL) { + goto exit; + } + if (strlen(errors) != (size_t)errors_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } +skip_optional_pos: return_value = unicode_encode_impl(self, encoding, errors); exit: @@ -202,7 +202,7 @@ PyDoc_STRVAR(unicode_expandtabs__doc__, "If tabsize is not given, a tab size of 8 characters is assumed."); #define UNICODE_EXPANDTABS_METHODDEF \ - {"expandtabs", (PyCFunction)(void(*)(void))unicode_expandtabs, METH_FASTCALL|METH_KEYWORDS, unicode_expandtabs__doc__}, + {"expandtabs", (PyCFunction)(void(*)(void))unicode_expandtabs, METH_FASTCALL|METH_KEYWORDS, unicode_expandtabs__doc__}, static PyObject * unicode_expandtabs_impl(PyObject *self, int tabsize); @@ -212,28 +212,28 @@ unicode_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb { PyObject *return_value = NULL; static const char * const _keywords[] = {"tabsize", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0}; - PyObject *argsbuf[1]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; + static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0}; + PyObject *argsbuf[1]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; int tabsize = 8; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); + if (!args) { goto exit; } - if (!noptargs) { - goto skip_optional_pos; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - tabsize = _PyLong_AsInt(args[0]); - if (tabsize == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: + if (!noptargs) { + goto skip_optional_pos; + } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + tabsize = _PyLong_AsInt(args[0]); + if (tabsize == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: return_value = unicode_expandtabs_impl(self, tabsize); exit: @@ -456,8 +456,8 @@ PyDoc_STRVAR(unicode_isidentifier__doc__, "\n" "Return True if the string is a valid Python identifier, False otherwise.\n" "\n" -"Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n" -"such as \"def\" or \"class\"."); +"Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n" +"such as \"def\" or \"class\"."); #define UNICODE_ISIDENTIFIER_METHODDEF \ {"isidentifier", (PyCFunction)unicode_isidentifier, METH_NOARGS, unicode_isidentifier__doc__}, @@ -515,7 +515,7 @@ PyDoc_STRVAR(unicode_ljust__doc__, "Padding is done using the specified fill character (default is a space)."); #define UNICODE_LJUST_METHODDEF \ - {"ljust", (PyCFunction)(void(*)(void))unicode_ljust, METH_FASTCALL, unicode_ljust__doc__}, + {"ljust", (PyCFunction)(void(*)(void))unicode_ljust, METH_FASTCALL, unicode_ljust__doc__}, static PyObject * unicode_ljust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar); @@ -527,33 +527,33 @@ unicode_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) Py_ssize_t width; Py_UCS4 fillchar = ' '; - if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) { - goto exit; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[0]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - width = ival; - } - if (nargs < 2) { - goto skip_optional; - } - if (!convert_uc(args[1], &fillchar)) { + if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) { goto exit; } -skip_optional: + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[0]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + width = ival; + } + if (nargs < 2) { + goto skip_optional; + } + if (!convert_uc(args[1], &fillchar)) { + goto exit; + } +skip_optional: return_value = unicode_ljust_impl(self, width, fillchar); exit: @@ -582,12 +582,12 @@ PyDoc_STRVAR(unicode_strip__doc__, "strip($self, chars=None, /)\n" "--\n" "\n" -"Return a copy of the string with leading and trailing whitespace removed.\n" +"Return a copy of the string with leading and trailing whitespace removed.\n" "\n" "If chars is given and not None, remove characters in chars instead."); #define UNICODE_STRIP_METHODDEF \ - {"strip", (PyCFunction)(void(*)(void))unicode_strip, METH_FASTCALL, unicode_strip__doc__}, + {"strip", (PyCFunction)(void(*)(void))unicode_strip, METH_FASTCALL, unicode_strip__doc__}, static PyObject * unicode_strip_impl(PyObject *self, PyObject *chars); @@ -598,14 +598,14 @@ unicode_strip(PyObject *self, PyObject *const *args, Py_ssize_t nargs) PyObject *return_value = NULL; PyObject *chars = Py_None; - if (!_PyArg_CheckPositional("strip", nargs, 0, 1)) { + if (!_PyArg_CheckPositional("strip", nargs, 0, 1)) { goto exit; } - if (nargs < 1) { - goto skip_optional; - } - chars = args[0]; -skip_optional: + if (nargs < 1) { + goto skip_optional; + } + chars = args[0]; +skip_optional: return_value = unicode_strip_impl(self, chars); exit: @@ -621,7 +621,7 @@ PyDoc_STRVAR(unicode_lstrip__doc__, "If chars is given and not None, remove characters in chars instead."); #define UNICODE_LSTRIP_METHODDEF \ - {"lstrip", (PyCFunction)(void(*)(void))unicode_lstrip, METH_FASTCALL, unicode_lstrip__doc__}, + {"lstrip", (PyCFunction)(void(*)(void))unicode_lstrip, METH_FASTCALL, unicode_lstrip__doc__}, static PyObject * unicode_lstrip_impl(PyObject *self, PyObject *chars); @@ -630,16 +630,16 @@ static PyObject * unicode_lstrip(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; - PyObject *chars = Py_None; + PyObject *chars = Py_None; - if (!_PyArg_CheckPositional("lstrip", nargs, 0, 1)) { + if (!_PyArg_CheckPositional("lstrip", nargs, 0, 1)) { goto exit; } - if (nargs < 1) { - goto skip_optional; - } - chars = args[0]; -skip_optional: + if (nargs < 1) { + goto skip_optional; + } + chars = args[0]; +skip_optional: return_value = unicode_lstrip_impl(self, chars); exit: @@ -655,7 +655,7 @@ PyDoc_STRVAR(unicode_rstrip__doc__, "If chars is given and not None, remove characters in chars instead."); #define UNICODE_RSTRIP_METHODDEF \ - {"rstrip", (PyCFunction)(void(*)(void))unicode_rstrip, METH_FASTCALL, unicode_rstrip__doc__}, + {"rstrip", (PyCFunction)(void(*)(void))unicode_rstrip, METH_FASTCALL, unicode_rstrip__doc__}, static PyObject * unicode_rstrip_impl(PyObject *self, PyObject *chars); @@ -664,16 +664,16 @@ static PyObject * unicode_rstrip(PyObject *self, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; - PyObject *chars = Py_None; + PyObject *chars = Py_None; - if (!_PyArg_CheckPositional("rstrip", nargs, 0, 1)) { + if (!_PyArg_CheckPositional("rstrip", nargs, 0, 1)) { goto exit; } - if (nargs < 1) { - goto skip_optional; - } - chars = args[0]; -skip_optional: + if (nargs < 1) { + goto skip_optional; + } + chars = args[0]; +skip_optional: return_value = unicode_rstrip_impl(self, chars); exit: @@ -694,7 +694,7 @@ PyDoc_STRVAR(unicode_replace__doc__, "replaced."); #define UNICODE_REPLACE_METHODDEF \ - {"replace", (PyCFunction)(void(*)(void))unicode_replace, METH_FASTCALL, unicode_replace__doc__}, + {"replace", (PyCFunction)(void(*)(void))unicode_replace, METH_FASTCALL, unicode_replace__doc__}, static PyObject * unicode_replace_impl(PyObject *self, PyObject *old, PyObject *new, @@ -708,123 +708,123 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs) PyObject *new; Py_ssize_t count = -1; - if (!_PyArg_CheckPositional("replace", nargs, 2, 3)) { - goto exit; - } - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("replace", "argument 1", "str", args[0]); - goto exit; - } - if (PyUnicode_READY(args[0]) == -1) { - goto exit; - } - old = args[0]; - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("replace", "argument 2", "str", args[1]); + if (!_PyArg_CheckPositional("replace", nargs, 2, 3)) { goto exit; } - if (PyUnicode_READY(args[1]) == -1) { - goto exit; - } - new = args[1]; - if (nargs < 3) { - goto skip_optional; - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[2]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - count = ival; - } -skip_optional: + if (!PyUnicode_Check(args[0])) { + _PyArg_BadArgument("replace", "argument 1", "str", args[0]); + goto exit; + } + if (PyUnicode_READY(args[0]) == -1) { + goto exit; + } + old = args[0]; + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("replace", "argument 2", "str", args[1]); + goto exit; + } + if (PyUnicode_READY(args[1]) == -1) { + goto exit; + } + new = args[1]; + if (nargs < 3) { + goto skip_optional; + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[2]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + count = ival; + } +skip_optional: return_value = unicode_replace_impl(self, old, new, count); exit: return return_value; } -PyDoc_STRVAR(unicode_removeprefix__doc__, -"removeprefix($self, prefix, /)\n" -"--\n" -"\n" -"Return a str with the given prefix string removed if present.\n" -"\n" -"If the string starts with the prefix string, return string[len(prefix):].\n" -"Otherwise, return a copy of the original string."); - -#define UNICODE_REMOVEPREFIX_METHODDEF \ - {"removeprefix", (PyCFunction)unicode_removeprefix, METH_O, unicode_removeprefix__doc__}, - -static PyObject * -unicode_removeprefix_impl(PyObject *self, PyObject *prefix); - -static PyObject * -unicode_removeprefix(PyObject *self, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *prefix; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("removeprefix", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - prefix = arg; - return_value = unicode_removeprefix_impl(self, prefix); - -exit: - return return_value; -} - -PyDoc_STRVAR(unicode_removesuffix__doc__, -"removesuffix($self, suffix, /)\n" -"--\n" -"\n" -"Return a str with the given suffix string removed if present.\n" -"\n" -"If the string ends with the suffix string and that suffix is not empty,\n" -"return string[:-len(suffix)]. Otherwise, return a copy of the original\n" -"string."); - -#define UNICODE_REMOVESUFFIX_METHODDEF \ - {"removesuffix", (PyCFunction)unicode_removesuffix, METH_O, unicode_removesuffix__doc__}, - -static PyObject * -unicode_removesuffix_impl(PyObject *self, PyObject *suffix); - -static PyObject * -unicode_removesuffix(PyObject *self, PyObject *arg) -{ - PyObject *return_value = NULL; - PyObject *suffix; - - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("removesuffix", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { - goto exit; - } - suffix = arg; - return_value = unicode_removesuffix_impl(self, suffix); - -exit: - return return_value; -} - +PyDoc_STRVAR(unicode_removeprefix__doc__, +"removeprefix($self, prefix, /)\n" +"--\n" +"\n" +"Return a str with the given prefix string removed if present.\n" +"\n" +"If the string starts with the prefix string, return string[len(prefix):].\n" +"Otherwise, return a copy of the original string."); + +#define UNICODE_REMOVEPREFIX_METHODDEF \ + {"removeprefix", (PyCFunction)unicode_removeprefix, METH_O, unicode_removeprefix__doc__}, + +static PyObject * +unicode_removeprefix_impl(PyObject *self, PyObject *prefix); + +static PyObject * +unicode_removeprefix(PyObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *prefix; + + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("removeprefix", "argument", "str", arg); + goto exit; + } + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + prefix = arg; + return_value = unicode_removeprefix_impl(self, prefix); + +exit: + return return_value; +} + +PyDoc_STRVAR(unicode_removesuffix__doc__, +"removesuffix($self, suffix, /)\n" +"--\n" +"\n" +"Return a str with the given suffix string removed if present.\n" +"\n" +"If the string ends with the suffix string and that suffix is not empty,\n" +"return string[:-len(suffix)]. Otherwise, return a copy of the original\n" +"string."); + +#define UNICODE_REMOVESUFFIX_METHODDEF \ + {"removesuffix", (PyCFunction)unicode_removesuffix, METH_O, unicode_removesuffix__doc__}, + +static PyObject * +unicode_removesuffix_impl(PyObject *self, PyObject *suffix); + +static PyObject * +unicode_removesuffix(PyObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *suffix; + + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("removesuffix", "argument", "str", arg); + goto exit; + } + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + suffix = arg; + return_value = unicode_removesuffix_impl(self, suffix); + +exit: + return return_value; +} + PyDoc_STRVAR(unicode_rjust__doc__, "rjust($self, width, fillchar=\' \', /)\n" "--\n" @@ -834,7 +834,7 @@ PyDoc_STRVAR(unicode_rjust__doc__, "Padding is done using the specified fill character (default is a space)."); #define UNICODE_RJUST_METHODDEF \ - {"rjust", (PyCFunction)(void(*)(void))unicode_rjust, METH_FASTCALL, unicode_rjust__doc__}, + {"rjust", (PyCFunction)(void(*)(void))unicode_rjust, METH_FASTCALL, unicode_rjust__doc__}, static PyObject * unicode_rjust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar); @@ -846,33 +846,33 @@ unicode_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) Py_ssize_t width; Py_UCS4 fillchar = ' '; - if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) { - goto exit; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[0]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - width = ival; - } - if (nargs < 2) { - goto skip_optional; - } - if (!convert_uc(args[1], &fillchar)) { + if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) { goto exit; } -skip_optional: + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[0]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + width = ival; + } + if (nargs < 2) { + goto skip_optional; + } + if (!convert_uc(args[1], &fillchar)) { + goto exit; + } +skip_optional: return_value = unicode_rjust_impl(self, width, fillchar); exit: @@ -894,7 +894,7 @@ PyDoc_STRVAR(unicode_split__doc__, " -1 (the default value) means no limit."); #define UNICODE_SPLIT_METHODDEF \ - {"split", (PyCFunction)(void(*)(void))unicode_split, METH_FASTCALL|METH_KEYWORDS, unicode_split__doc__}, + {"split", (PyCFunction)(void(*)(void))unicode_split, METH_FASTCALL|METH_KEYWORDS, unicode_split__doc__}, static PyObject * unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit); @@ -904,43 +904,43 @@ unicode_split(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject { PyObject *return_value = NULL; static const char * const _keywords[] = {"sep", "maxsplit", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "split", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; + static _PyArg_Parser _parser = {NULL, _keywords, "split", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; PyObject *sep = Py_None; Py_ssize_t maxsplit = -1; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); - if (!args) { - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[0]) { - sep = args[0]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); + if (!args) { goto exit; } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - maxsplit = ival; - } -skip_optional_pos: + if (!noptargs) { + goto skip_optional_pos; + } + if (args[0]) { + sep = args[0]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[1]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + maxsplit = ival; + } +skip_optional_pos: return_value = unicode_split_impl(self, sep, maxsplit); exit: @@ -996,7 +996,7 @@ PyDoc_STRVAR(unicode_rsplit__doc__, "Splits are done starting at the end of the string and working to the front."); #define UNICODE_RSPLIT_METHODDEF \ - {"rsplit", (PyCFunction)(void(*)(void))unicode_rsplit, METH_FASTCALL|METH_KEYWORDS, unicode_rsplit__doc__}, + {"rsplit", (PyCFunction)(void(*)(void))unicode_rsplit, METH_FASTCALL|METH_KEYWORDS, unicode_rsplit__doc__}, static PyObject * unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit); @@ -1006,43 +1006,43 @@ unicode_rsplit(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject { PyObject *return_value = NULL; static const char * const _keywords[] = {"sep", "maxsplit", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "rsplit", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; + static _PyArg_Parser _parser = {NULL, _keywords, "rsplit", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; PyObject *sep = Py_None; Py_ssize_t maxsplit = -1; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf); + if (!args) { goto exit; } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[0]) { - sep = args[0]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(args[1]); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - maxsplit = ival; - } -skip_optional_pos: + if (!noptargs) { + goto skip_optional_pos; + } + if (args[0]) { + sep = args[0]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(args[1]); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + maxsplit = ival; + } +skip_optional_pos: return_value = unicode_rsplit_impl(self, sep, maxsplit); exit: @@ -1059,7 +1059,7 @@ PyDoc_STRVAR(unicode_splitlines__doc__, "true."); #define UNICODE_SPLITLINES_METHODDEF \ - {"splitlines", (PyCFunction)(void(*)(void))unicode_splitlines, METH_FASTCALL|METH_KEYWORDS, unicode_splitlines__doc__}, + {"splitlines", (PyCFunction)(void(*)(void))unicode_splitlines, METH_FASTCALL|METH_KEYWORDS, unicode_splitlines__doc__}, static PyObject * unicode_splitlines_impl(PyObject *self, int keepends); @@ -1069,28 +1069,28 @@ unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb { PyObject *return_value = NULL; static const char * const _keywords[] = {"keepends", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "splitlines", 0}; - PyObject *argsbuf[1]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; + static _PyArg_Parser _parser = {NULL, _keywords, "splitlines", 0}; + PyObject *argsbuf[1]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; int keepends = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); - if (!args) { + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf); + if (!args) { goto exit; } - if (!noptargs) { - goto skip_optional_pos; - } - if (PyFloat_Check(args[0])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - keepends = _PyLong_AsInt(args[0]); - if (keepends == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: + if (!noptargs) { + goto skip_optional_pos; + } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + keepends = _PyLong_AsInt(args[0]); + if (keepends == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: return_value = unicode_splitlines_impl(self, keepends); exit: @@ -1116,7 +1116,7 @@ unicode_swapcase(PyObject *self, PyObject *Py_UNUSED(ignored)) } PyDoc_STRVAR(unicode_maketrans__doc__, -"maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)\n" +"maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)\n" "--\n" "\n" "Return a translation table usable for str.translate().\n" @@ -1130,7 +1130,7 @@ PyDoc_STRVAR(unicode_maketrans__doc__, "must be a string, whose characters will be mapped to None in the result."); #define UNICODE_MAKETRANS_METHODDEF \ - {"maketrans", (PyCFunction)(void(*)(void))unicode_maketrans, METH_FASTCALL|METH_STATIC, unicode_maketrans__doc__}, + {"maketrans", (PyCFunction)(void(*)(void))unicode_maketrans, METH_FASTCALL|METH_STATIC, unicode_maketrans__doc__}, static PyObject * unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z); @@ -1143,33 +1143,33 @@ unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs) PyObject *y = NULL; PyObject *z = NULL; - if (!_PyArg_CheckPositional("maketrans", nargs, 1, 3)) { - goto exit; - } - x = args[0]; - if (nargs < 2) { - goto skip_optional; - } - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("maketrans", "argument 2", "str", args[1]); - goto exit; - } - if (PyUnicode_READY(args[1]) == -1) { - goto exit; - } - y = args[1]; - if (nargs < 3) { - goto skip_optional; - } - if (!PyUnicode_Check(args[2])) { - _PyArg_BadArgument("maketrans", "argument 3", "str", args[2]); - goto exit; - } - if (PyUnicode_READY(args[2]) == -1) { + if (!_PyArg_CheckPositional("maketrans", nargs, 1, 3)) { goto exit; } - z = args[2]; -skip_optional: + x = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("maketrans", "argument 2", "str", args[1]); + goto exit; + } + if (PyUnicode_READY(args[1]) == -1) { + goto exit; + } + y = args[1]; + if (nargs < 3) { + goto skip_optional; + } + if (!PyUnicode_Check(args[2])) { + _PyArg_BadArgument("maketrans", "argument 3", "str", args[2]); + goto exit; + } + if (PyUnicode_READY(args[2]) == -1) { + goto exit; + } + z = args[2]; +skip_optional: return_value = unicode_maketrans_impl(x, y, z); exit: @@ -1231,23 +1231,23 @@ unicode_zfill(PyObject *self, PyObject *arg) PyObject *return_value = NULL; Py_ssize_t width; - if (PyFloat_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); + if (PyFloat_Check(arg)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); goto exit; } - { - Py_ssize_t ival = -1; - PyObject *iobj = PyNumber_Index(arg); - if (iobj != NULL) { - ival = PyLong_AsSsize_t(iobj); - Py_DECREF(iobj); - } - if (ival == -1 && PyErr_Occurred()) { - goto exit; - } - width = ival; - } + { + Py_ssize_t ival = -1; + PyObject *iobj = PyNumber_Index(arg); + if (iobj != NULL) { + ival = PyLong_AsSsize_t(iobj); + Py_DECREF(iobj); + } + if (ival == -1 && PyErr_Occurred()) { + goto exit; + } + width = ival; + } return_value = unicode_zfill_impl(self, width); exit: @@ -1272,14 +1272,14 @@ unicode___format__(PyObject *self, PyObject *arg) PyObject *return_value = NULL; PyObject *format_spec; - if (!PyUnicode_Check(arg)) { - _PyArg_BadArgument("__format__", "argument", "str", arg); - goto exit; - } - if (PyUnicode_READY(arg) == -1) { + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("__format__", "argument", "str", arg); goto exit; } - format_spec = arg; + if (PyUnicode_READY(arg) == -1) { + goto exit; + } + format_spec = arg; return_value = unicode___format___impl(self, format_spec); exit: @@ -1303,4 +1303,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored)) { return unicode_sizeof_impl(self); } -/*[clinic end generated code: output=b91233f3722643be input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b91233f3722643be input=a9049054013a1b77]*/ |