diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Objects/stringlib | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Objects/stringlib')
12 files changed, 482 insertions, 482 deletions
diff --git a/contrib/tools/python3/src/Objects/stringlib/asciilib.h b/contrib/tools/python3/src/Objects/stringlib/asciilib.h index 23c954ba73..e69a2c076e 100644 --- a/contrib/tools/python3/src/Objects/stringlib/asciilib.h +++ b/contrib/tools/python3/src/Objects/stringlib/asciilib.h @@ -18,7 +18,7 @@ #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL #define STRINGLIB_STR PyUnicode_1BYTE_DATA #define STRINGLIB_LEN PyUnicode_GET_LENGTH -#define STRINGLIB_NEW(STR,LEN) _PyUnicode_FromASCII((const char*)(STR),(LEN)) +#define STRINGLIB_NEW(STR,LEN) _PyUnicode_FromASCII((const char*)(STR),(LEN)) #define STRINGLIB_CHECK PyUnicode_Check #define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact diff --git a/contrib/tools/python3/src/Objects/stringlib/clinic/transmogrify.h.h b/contrib/tools/python3/src/Objects/stringlib/clinic/transmogrify.h.h index a3fca6a710..8a3a060f12 100644 --- a/contrib/tools/python3/src/Objects/stringlib/clinic/transmogrify.h.h +++ b/contrib/tools/python3/src/Objects/stringlib/clinic/transmogrify.h.h @@ -1,277 +1,277 @@ -/*[clinic input] -preserve -[clinic start generated code]*/ - -PyDoc_STRVAR(stringlib_expandtabs__doc__, -"expandtabs($self, /, tabsize=8)\n" -"--\n" -"\n" -"Return a copy where all tab characters are expanded using spaces.\n" -"\n" -"If tabsize is not given, a tab size of 8 characters is assumed."); - -#define STRINGLIB_EXPANDTABS_METHODDEF \ - {"expandtabs", (PyCFunction)(void(*)(void))stringlib_expandtabs, METH_FASTCALL|METH_KEYWORDS, stringlib_expandtabs__doc__}, - -static PyObject * -stringlib_expandtabs_impl(PyObject *self, int tabsize); - -static PyObject * -stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) -{ - 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; - int tabsize = 8; - - 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: - return_value = stringlib_expandtabs_impl(self, tabsize); - -exit: - return return_value; -} - -PyDoc_STRVAR(stringlib_ljust__doc__, -"ljust($self, width, fillchar=b\' \', /)\n" -"--\n" -"\n" -"Return a left-justified string of length width.\n" -"\n" -"Padding is done using the specified fill character."); - -#define STRINGLIB_LJUST_METHODDEF \ - {"ljust", (PyCFunction)(void(*)(void))stringlib_ljust, METH_FASTCALL, stringlib_ljust__doc__}, - -static PyObject * -stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar); - -static PyObject * -stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - Py_ssize_t width; - char 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { - fillchar = PyBytes_AS_STRING(args[1])[0]; - } - else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { - fillchar = PyByteArray_AS_STRING(args[1])[0]; - } - else { - _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]); - goto exit; - } -skip_optional: - return_value = stringlib_ljust_impl(self, width, fillchar); - -exit: - return return_value; -} - -PyDoc_STRVAR(stringlib_rjust__doc__, -"rjust($self, width, fillchar=b\' \', /)\n" -"--\n" -"\n" -"Return a right-justified string of length width.\n" -"\n" -"Padding is done using the specified fill character."); - -#define STRINGLIB_RJUST_METHODDEF \ - {"rjust", (PyCFunction)(void(*)(void))stringlib_rjust, METH_FASTCALL, stringlib_rjust__doc__}, - -static PyObject * -stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar); - -static PyObject * -stringlib_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - Py_ssize_t width; - char 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { - fillchar = PyBytes_AS_STRING(args[1])[0]; - } - else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { - fillchar = PyByteArray_AS_STRING(args[1])[0]; - } - else { - _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]); - goto exit; - } -skip_optional: - return_value = stringlib_rjust_impl(self, width, fillchar); - -exit: - return return_value; -} - -PyDoc_STRVAR(stringlib_center__doc__, -"center($self, width, fillchar=b\' \', /)\n" -"--\n" -"\n" -"Return a centered string of length width.\n" -"\n" -"Padding is done using the specified fill character."); - -#define STRINGLIB_CENTER_METHODDEF \ - {"center", (PyCFunction)(void(*)(void))stringlib_center, METH_FASTCALL, stringlib_center__doc__}, - -static PyObject * -stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar); - -static PyObject * -stringlib_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs) -{ - PyObject *return_value = NULL; - Py_ssize_t width; - char fillchar = ' '; - - 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { - fillchar = PyBytes_AS_STRING(args[1])[0]; - } - else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { - fillchar = PyByteArray_AS_STRING(args[1])[0]; - } - else { - _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]); - goto exit; - } -skip_optional: - return_value = stringlib_center_impl(self, width, fillchar); - -exit: - return return_value; -} - -PyDoc_STRVAR(stringlib_zfill__doc__, -"zfill($self, width, /)\n" -"--\n" -"\n" -"Pad a numeric string with zeros on the left, to fill a field of the given width.\n" -"\n" -"The original string is never truncated."); - -#define STRINGLIB_ZFILL_METHODDEF \ - {"zfill", (PyCFunction)stringlib_zfill, METH_O, stringlib_zfill__doc__}, - -static PyObject * -stringlib_zfill_impl(PyObject *self, Py_ssize_t width); - -static PyObject * -stringlib_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" ); - 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; - } - return_value = stringlib_zfill_impl(self, width); - -exit: - return return_value; -} -/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(stringlib_expandtabs__doc__, +"expandtabs($self, /, tabsize=8)\n" +"--\n" +"\n" +"Return a copy where all tab characters are expanded using spaces.\n" +"\n" +"If tabsize is not given, a tab size of 8 characters is assumed."); + +#define STRINGLIB_EXPANDTABS_METHODDEF \ + {"expandtabs", (PyCFunction)(void(*)(void))stringlib_expandtabs, METH_FASTCALL|METH_KEYWORDS, stringlib_expandtabs__doc__}, + +static PyObject * +stringlib_expandtabs_impl(PyObject *self, int tabsize); + +static PyObject * +stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +{ + 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; + int tabsize = 8; + + 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: + return_value = stringlib_expandtabs_impl(self, tabsize); + +exit: + return return_value; +} + +PyDoc_STRVAR(stringlib_ljust__doc__, +"ljust($self, width, fillchar=b\' \', /)\n" +"--\n" +"\n" +"Return a left-justified string of length width.\n" +"\n" +"Padding is done using the specified fill character."); + +#define STRINGLIB_LJUST_METHODDEF \ + {"ljust", (PyCFunction)(void(*)(void))stringlib_ljust, METH_FASTCALL, stringlib_ljust__doc__}, + +static PyObject * +stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar); + +static PyObject * +stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + Py_ssize_t width; + char 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { + fillchar = PyBytes_AS_STRING(args[1])[0]; + } + else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { + fillchar = PyByteArray_AS_STRING(args[1])[0]; + } + else { + _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]); + goto exit; + } +skip_optional: + return_value = stringlib_ljust_impl(self, width, fillchar); + +exit: + return return_value; +} + +PyDoc_STRVAR(stringlib_rjust__doc__, +"rjust($self, width, fillchar=b\' \', /)\n" +"--\n" +"\n" +"Return a right-justified string of length width.\n" +"\n" +"Padding is done using the specified fill character."); + +#define STRINGLIB_RJUST_METHODDEF \ + {"rjust", (PyCFunction)(void(*)(void))stringlib_rjust, METH_FASTCALL, stringlib_rjust__doc__}, + +static PyObject * +stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar); + +static PyObject * +stringlib_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + Py_ssize_t width; + char 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { + fillchar = PyBytes_AS_STRING(args[1])[0]; + } + else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { + fillchar = PyByteArray_AS_STRING(args[1])[0]; + } + else { + _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]); + goto exit; + } +skip_optional: + return_value = stringlib_rjust_impl(self, width, fillchar); + +exit: + return return_value; +} + +PyDoc_STRVAR(stringlib_center__doc__, +"center($self, width, fillchar=b\' \', /)\n" +"--\n" +"\n" +"Return a centered string of length width.\n" +"\n" +"Padding is done using the specified fill character."); + +#define STRINGLIB_CENTER_METHODDEF \ + {"center", (PyCFunction)(void(*)(void))stringlib_center, METH_FASTCALL, stringlib_center__doc__}, + +static PyObject * +stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar); + +static PyObject * +stringlib_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + Py_ssize_t width; + char fillchar = ' '; + + 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 (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) { + fillchar = PyBytes_AS_STRING(args[1])[0]; + } + else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) { + fillchar = PyByteArray_AS_STRING(args[1])[0]; + } + else { + _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]); + goto exit; + } +skip_optional: + return_value = stringlib_center_impl(self, width, fillchar); + +exit: + return return_value; +} + +PyDoc_STRVAR(stringlib_zfill__doc__, +"zfill($self, width, /)\n" +"--\n" +"\n" +"Pad a numeric string with zeros on the left, to fill a field of the given width.\n" +"\n" +"The original string is never truncated."); + +#define STRINGLIB_ZFILL_METHODDEF \ + {"zfill", (PyCFunction)stringlib_zfill, METH_O, stringlib_zfill__doc__}, + +static PyObject * +stringlib_zfill_impl(PyObject *self, Py_ssize_t width); + +static PyObject * +stringlib_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" ); + 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; + } + return_value = stringlib_zfill_impl(self, width); + +exit: + return return_value; +} +/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/ diff --git a/contrib/tools/python3/src/Objects/stringlib/codecs.h b/contrib/tools/python3/src/Objects/stringlib/codecs.h index 742be90abd..9b2a29ba3b 100644 --- a/contrib/tools/python3/src/Objects/stringlib/codecs.h +++ b/contrib/tools/python3/src/Objects/stringlib/codecs.h @@ -4,8 +4,8 @@ # error "codecs.h is specific to Unicode" #endif -#include "pycore_byteswap.h" // _Py_bswap32() - +#include "pycore_byteswap.h" // _Py_bswap32() + /* Mask to quickly check whether a C 'long' contains a non-ASCII, UTF8-encoded char. */ #if (SIZEOF_LONG == 8) @@ -48,7 +48,7 @@ STRINGLIB(utf8_decode)(const char **inptr, const char *end, /* Read a whole long at a time (either 4 or 8 bytes), and do a fast unrolled copy if it only contains ASCII characters. */ - unsigned long value = *(const unsigned long *) _s; + unsigned long value = *(const unsigned long *) _s; if (value & ASCII_CHAR_MASK) break; #if PY_LITTLE_ENDIAN @@ -155,7 +155,7 @@ STRINGLIB(utf8_decode)(const char **inptr, const char *end, /* Decoding UTF-8 sequences in range \xED\xA0\x80-\xED\xBF\xBF will result in surrogates in range D800-DFFF. Surrogates are not valid UTF-8 so they are rejected. - See https://www.unicode.org/versions/Unicode5.2.0/ch03.pdf + See https://www.unicode.org/versions/Unicode5.2.0/ch03.pdf (table 3-7) and http://www.rfc-editor.org/rfc/rfc3629.txt */ goto InvalidContinuation1; } @@ -209,7 +209,7 @@ STRINGLIB(utf8_decode)(const char **inptr, const char *end, goto InvalidContinuation1; } else if (ch == 0xF4 && ch2 >= 0x90) { /* invalid sequence - \xF4\x90\x80\x80- -- 110000- overflow */ + \xF4\x90\x80\x80- -- 110000- overflow */ goto InvalidContinuation1; } if (!IS_CONTINUATION_BYTE(ch3)) { @@ -258,12 +258,12 @@ InvalidContinuation3: /* UTF-8 encoder specialized for a Unicode kind to avoid the slow PyUnicode_READ() macro. Delete some parts of the code depending on the kind: UCS-1 strings don't need to handle surrogates for example. */ -Py_LOCAL_INLINE(char *) -STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, - PyObject *unicode, - const STRINGLIB_CHAR *data, +Py_LOCAL_INLINE(char *) +STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, + PyObject *unicode, + const STRINGLIB_CHAR *data, Py_ssize_t size, - _Py_error_handler error_handler, + _Py_error_handler error_handler, const char *errors) { Py_ssize_t i; /* index into data of next input character */ @@ -284,12 +284,12 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, assert(size >= 0); if (size > PY_SSIZE_T_MAX / max_char_size) { /* integer overflow */ - PyErr_NoMemory(); - return NULL; + PyErr_NoMemory(); + return NULL; } - _PyBytesWriter_Init(writer); - p = _PyBytesWriter_Alloc(writer, size * max_char_size); + _PyBytesWriter_Init(writer); + p = _PyBytesWriter_Alloc(writer, size * max_char_size); if (p == NULL) return NULL; @@ -315,7 +315,7 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, Py_ssize_t startpos, endpos, newpos; Py_ssize_t k; if (error_handler == _Py_ERROR_UNKNOWN) { - error_handler = _Py_GetErrorHandler(errors); + error_handler = _Py_GetErrorHandler(errors); } startpos = i-1; @@ -325,7 +325,7 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, endpos++; /* Only overallocate the buffer if it's not the last write */ - writer->overallocate = (endpos < size); + writer->overallocate = (endpos < size); switch (error_handler) { @@ -349,8 +349,8 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, case _Py_ERROR_BACKSLASHREPLACE: /* subtract preallocated bytes */ - writer->min_size -= max_char_size * (endpos - startpos); - p = backslashreplace(writer, p, + writer->min_size -= max_char_size * (endpos - startpos); + p = backslashreplace(writer, p, unicode, startpos, endpos); if (p == NULL) goto error; @@ -359,8 +359,8 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, case _Py_ERROR_XMLCHARREFREPLACE: /* subtract preallocated bytes */ - writer->min_size -= max_char_size * (endpos - startpos); - p = xmlcharrefreplace(writer, p, + writer->min_size -= max_char_size * (endpos - startpos); + p = xmlcharrefreplace(writer, p, unicode, startpos, endpos); if (p == NULL) goto error; @@ -389,10 +389,10 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, goto error; /* subtract preallocated bytes */ - writer->min_size -= max_char_size * (newpos - startpos); + writer->min_size -= max_char_size * (newpos - startpos); if (PyBytes_Check(rep)) { - p = _PyBytesWriter_WriteBytes(writer, p, + p = _PyBytesWriter_WriteBytes(writer, p, PyBytes_AS_STRING(rep), PyBytes_GET_SIZE(rep)); } @@ -408,7 +408,7 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, goto error; } - p = _PyBytesWriter_WriteBytes(writer, p, + p = _PyBytesWriter_WriteBytes(writer, p, PyUnicode_DATA(rep), PyUnicode_GET_LENGTH(rep)); } @@ -422,7 +422,7 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, /* If overallocation was disabled, ensure that it was the last write. Otherwise, we missed an optimization */ - assert(writer->overallocate || i == size); + assert(writer->overallocate || i == size); } else #if STRINGLIB_SIZEOF_CHAR > 2 @@ -451,7 +451,7 @@ STRINGLIB(utf8_encoder)(_PyBytesWriter *writer, Py_XDECREF(error_handler_obj); Py_XDECREF(exc); #endif - return p; + return p; #if STRINGLIB_SIZEOF_CHAR > 1 error: @@ -516,7 +516,7 @@ STRINGLIB(utf16_decode)(const unsigned char **inptr, const unsigned char *e, /* Fast path for runs of in-range non-surrogate chars. */ const unsigned char *_q = q; while (_q < aligned_end) { - unsigned long block = * (const unsigned long *) _q; + unsigned long block = * (const unsigned long *) _q; if (native_ordering) { /* Can use buffer directly */ if (block & FAST_CHAR_MASK) @@ -574,8 +574,8 @@ STRINGLIB(utf16_decode)(const unsigned char **inptr, const unsigned char *e, } /* UTF-16 code pair: */ - if (!Py_UNICODE_IS_HIGH_SURROGATE(ch)) - goto IllegalEncoding; + if (!Py_UNICODE_IS_HIGH_SURROGATE(ch)) + goto IllegalEncoding; if (q >= e) goto UnexpectedEnd; ch2 = (q[ihi] << 8) | q[ilo]; @@ -734,28 +734,28 @@ STRINGLIB(utf16_encode)(const STRINGLIB_CHAR *in, #endif } -static inline uint32_t -STRINGLIB(SWAB4)(STRINGLIB_CHAR ch) -{ - uint32_t word = ch; +static inline uint32_t +STRINGLIB(SWAB4)(STRINGLIB_CHAR ch) +{ + uint32_t word = ch; #if STRINGLIB_SIZEOF_CHAR == 1 - /* high bytes are zero */ - return (word << 24); + /* high bytes are zero */ + return (word << 24); #elif STRINGLIB_SIZEOF_CHAR == 2 - /* high bytes are zero */ - return ((word & 0x00FFu) << 24) | ((word & 0xFF00u) << 8); + /* high bytes are zero */ + return ((word & 0x00FFu) << 24) | ((word & 0xFF00u) << 8); #else - return _Py_bswap32(word); + return _Py_bswap32(word); #endif -} - +} + Py_LOCAL_INLINE(Py_ssize_t) STRINGLIB(utf32_encode)(const STRINGLIB_CHAR *in, Py_ssize_t len, - uint32_t **outptr, + uint32_t **outptr, int native_ordering) { - uint32_t *out = *outptr; + uint32_t *out = *outptr; const STRINGLIB_CHAR *end = in + len; if (native_ordering) { const STRINGLIB_CHAR *unrolled_end = in + _Py_SIZE_ROUND_DOWN(len, 4); @@ -796,10 +796,10 @@ STRINGLIB(utf32_encode)(const STRINGLIB_CHAR *in, (in[3] ^ 0xd800) & 0xf800) == 0) break; #endif - out[0] = STRINGLIB(SWAB4)(in[0]); - out[1] = STRINGLIB(SWAB4)(in[1]); - out[2] = STRINGLIB(SWAB4)(in[2]); - out[3] = STRINGLIB(SWAB4)(in[3]); + out[0] = STRINGLIB(SWAB4)(in[0]); + out[1] = STRINGLIB(SWAB4)(in[1]); + out[2] = STRINGLIB(SWAB4)(in[2]); + out[3] = STRINGLIB(SWAB4)(in[3]); in += 4; out += 4; } while (in < end) { @@ -810,7 +810,7 @@ STRINGLIB(utf32_encode)(const STRINGLIB_CHAR *in, goto fail; } #endif - *out++ = STRINGLIB(SWAB4)(ch); + *out++ = STRINGLIB(SWAB4)(ch); } } *outptr = out; diff --git a/contrib/tools/python3/src/Objects/stringlib/ctype.h b/contrib/tools/python3/src/Objects/stringlib/ctype.h index b11d38eb06..9b319b07d1 100644 --- a/contrib/tools/python3/src/Objects/stringlib/ctype.h +++ b/contrib/tools/python3/src/Objects/stringlib/ctype.h @@ -2,52 +2,52 @@ # error "ctype.h only compatible with byte-wise strings" #endif -#include "pycore_bytes_methods.h" +#include "pycore_bytes_methods.h" static PyObject* -stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isspace(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_isalpha(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isalpha(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_isalnum(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isalnum(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_isascii(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isascii(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isascii(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_isdigit(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isdigit(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_islower(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_islower(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_isupper(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_isupper(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } static PyObject* -stringlib_istitle(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_istitle(PyObject *self, PyObject *Py_UNUSED(ignored)) { return _Py_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } @@ -56,7 +56,7 @@ stringlib_istitle(PyObject *self, PyObject *Py_UNUSED(ignored)) /* functions that return a new object partially translated by ctype funcs: */ static PyObject* -stringlib_lower(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_lower(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* newobj; newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); @@ -68,7 +68,7 @@ stringlib_lower(PyObject *self, PyObject *Py_UNUSED(ignored)) } static PyObject* -stringlib_upper(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_upper(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* newobj; newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); @@ -80,7 +80,7 @@ stringlib_upper(PyObject *self, PyObject *Py_UNUSED(ignored)) } static PyObject* -stringlib_title(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_title(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* newobj; newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); @@ -92,7 +92,7 @@ stringlib_title(PyObject *self, PyObject *Py_UNUSED(ignored)) } static PyObject* -stringlib_capitalize(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_capitalize(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* newobj; newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); @@ -104,7 +104,7 @@ stringlib_capitalize(PyObject *self, PyObject *Py_UNUSED(ignored)) } static PyObject* -stringlib_swapcase(PyObject *self, PyObject *Py_UNUSED(ignored)) +stringlib_swapcase(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* newobj; newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); diff --git a/contrib/tools/python3/src/Objects/stringlib/eq.h b/contrib/tools/python3/src/Objects/stringlib/eq.h index a3cec94e23..9c1058b86c 100644 --- a/contrib/tools/python3/src/Objects/stringlib/eq.h +++ b/contrib/tools/python3/src/Objects/stringlib/eq.h @@ -6,11 +6,11 @@ Py_LOCAL_INLINE(int) unicode_eq(PyObject *aa, PyObject *bb) { - assert(PyUnicode_Check(aa)); - assert(PyUnicode_Check(bb)); - assert(PyUnicode_IS_READY(aa)); - assert(PyUnicode_IS_READY(bb)); - + assert(PyUnicode_Check(aa)); + assert(PyUnicode_Check(bb)); + assert(PyUnicode_IS_READY(aa)); + assert(PyUnicode_IS_READY(bb)); + PyUnicodeObject *a = (PyUnicodeObject *)aa; PyUnicodeObject *b = (PyUnicodeObject *)bb; diff --git a/contrib/tools/python3/src/Objects/stringlib/fastsearch.h b/contrib/tools/python3/src/Objects/stringlib/fastsearch.h index 7c31649eba..56a4467d35 100644 --- a/contrib/tools/python3/src/Objects/stringlib/fastsearch.h +++ b/contrib/tools/python3/src/Objects/stringlib/fastsearch.h @@ -52,7 +52,7 @@ STRINGLIB(find_char)(const STRINGLIB_CHAR* s, Py_ssize_t n, STRINGLIB_CHAR ch) return (p - s); return -1; #else - /* use memchr if we can choose a needle without too many likely + /* use memchr if we can choose a needle without too many likely false positives */ const STRINGLIB_CHAR *s1, *e1; unsigned char needle = ch & 0xff; @@ -111,7 +111,7 @@ STRINGLIB(rfind_char)(const STRINGLIB_CHAR* s, Py_ssize_t n, STRINGLIB_CHAR ch) return (p - s); return -1; #else - /* use memrchr if we can choose a needle without too many likely + /* use memrchr if we can choose a needle without too many likely false positives */ const STRINGLIB_CHAR *s1; Py_ssize_t n1; diff --git a/contrib/tools/python3/src/Objects/stringlib/find_max_char.h b/contrib/tools/python3/src/Objects/stringlib/find_max_char.h index 2e6bb63b86..f4e0a7761d 100644 --- a/contrib/tools/python3/src/Objects/stringlib/find_max_char.h +++ b/contrib/tools/python3/src/Objects/stringlib/find_max_char.h @@ -28,7 +28,7 @@ STRINGLIB(find_max_char)(const STRINGLIB_CHAR *begin, const STRINGLIB_CHAR *end) /* Help register allocation */ const unsigned char *_p = p; while (_p < aligned_end) { - unsigned long value = *(const unsigned long *) _p; + unsigned long value = *(const unsigned long *) _p; if (value & UCS1_ASCII_CHAR_MASK) return 255; _p += SIZEOF_LONG; diff --git a/contrib/tools/python3/src/Objects/stringlib/join.h b/contrib/tools/python3/src/Objects/stringlib/join.h index 5573924a49..53bcbdea7a 100644 --- a/contrib/tools/python3/src/Objects/stringlib/join.h +++ b/contrib/tools/python3/src/Objects/stringlib/join.h @@ -7,8 +7,8 @@ Py_LOCAL_INLINE(PyObject *) STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) { - const char *sepstr = STRINGLIB_STR(sep); - Py_ssize_t seplen = STRINGLIB_LEN(sep); + const char *sepstr = STRINGLIB_STR(sep); + Py_ssize_t seplen = STRINGLIB_LEN(sep); PyObject *res = NULL; char *p; Py_ssize_t seqlen = 0; @@ -18,9 +18,9 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) Py_buffer *buffers = NULL; #define NB_STATIC_BUFFERS 10 Py_buffer static_buffers[NB_STATIC_BUFFERS]; -#define GIL_THRESHOLD 1048576 - int drop_gil = 1; - PyThreadState *save = NULL; +#define GIL_THRESHOLD 1048576 + int drop_gil = 1; + PyThreadState *save = NULL; seq = PySequence_Fast(iterable, "can only join an iterable"); if (seq == NULL) { @@ -68,21 +68,21 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) buffers[i].buf = PyBytes_AS_STRING(item); buffers[i].len = PyBytes_GET_SIZE(item); } - else { - if (PyObject_GetBuffer(item, &buffers[i], PyBUF_SIMPLE) != 0) { - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected a bytes-like object, " - "%.80s found", - i, Py_TYPE(item)->tp_name); - goto error; - } - /* If the backing objects are mutable, then dropping the GIL - * opens up race conditions where another thread tries to modify - * the object which we hold a buffer on it. Such code has data - * races anyway, but this is a conservative approach that avoids - * changing the behaviour of that data race. - */ - drop_gil = 0; + else { + if (PyObject_GetBuffer(item, &buffers[i], PyBUF_SIMPLE) != 0) { + PyErr_Format(PyExc_TypeError, + "sequence item %zd: expected a bytes-like object, " + "%.80s found", + i, Py_TYPE(item)->tp_name); + goto error; + } + /* If the backing objects are mutable, then dropping the GIL + * opens up race conditions where another thread tries to modify + * the object which we hold a buffer on it. Such code has data + * races anyway, but this is a conservative approach that avoids + * changing the behaviour of that data race. + */ + drop_gil = 0; } nbufs = i + 1; /* for error cleanup */ itemlen = buffers[i].len; @@ -114,12 +114,12 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) /* Catenate everything. */ p = STRINGLIB_STR(res); - if (sz < GIL_THRESHOLD) { - drop_gil = 0; /* Benefits are likely outweighed by the overheads */ - } - if (drop_gil) { - save = PyEval_SaveThread(); - } + if (sz < GIL_THRESHOLD) { + drop_gil = 0; /* Benefits are likely outweighed by the overheads */ + } + if (drop_gil) { + save = PyEval_SaveThread(); + } if (!seplen) { /* fast path */ for (i = 0; i < nbufs; i++) { @@ -129,23 +129,23 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable) p += n; } } - else { - for (i = 0; i < nbufs; i++) { - Py_ssize_t n; - char *q; - if (i) { - memcpy(p, sepstr, seplen); - p += seplen; - } - n = buffers[i].len; - q = buffers[i].buf; - memcpy(p, q, n); - p += n; + else { + for (i = 0; i < nbufs; i++) { + Py_ssize_t n; + char *q; + if (i) { + memcpy(p, sepstr, seplen); + p += seplen; + } + n = buffers[i].len; + q = buffers[i].buf; + memcpy(p, q, n); + p += n; } } - if (drop_gil) { - PyEval_RestoreThread(save); - } + if (drop_gil) { + PyEval_RestoreThread(save); + } goto done; error: @@ -160,4 +160,4 @@ done: } #undef NB_STATIC_BUFFERS -#undef GIL_THRESHOLD +#undef GIL_THRESHOLD diff --git a/contrib/tools/python3/src/Objects/stringlib/localeutil.h b/contrib/tools/python3/src/Objects/stringlib/localeutil.h index 48ec1c0a4c..bd16e0a172 100644 --- a/contrib/tools/python3/src/Objects/stringlib/localeutil.h +++ b/contrib/tools/python3/src/Objects/stringlib/localeutil.h @@ -77,6 +77,6 @@ InsertThousandsGrouping_fill(_PyUnicodeWriter *writer, Py_ssize_t *buffer_pos, *buffer_pos -= n_zeros; enum PyUnicode_Kind kind = PyUnicode_KIND(writer->buffer); void *data = PyUnicode_DATA(writer->buffer); - unicode_fill(kind, data, '0', *buffer_pos, n_zeros); + unicode_fill(kind, data, '0', *buffer_pos, n_zeros); } } diff --git a/contrib/tools/python3/src/Objects/stringlib/split.h b/contrib/tools/python3/src/Objects/stringlib/split.h index 4511518ed7..068047f987 100644 --- a/contrib/tools/python3/src/Objects/stringlib/split.h +++ b/contrib/tools/python3/src/Objects/stringlib/split.h @@ -48,7 +48,7 @@ /* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SET_SIZE(list, count) +#define FIX_PREALLOC_SIZE(list) Py_SET_SIZE(list, count) Py_LOCAL_INLINE(PyObject *) STRINGLIB(split_whitespace)(PyObject* str_obj, diff --git a/contrib/tools/python3/src/Objects/stringlib/transmogrify.h b/contrib/tools/python3/src/Objects/stringlib/transmogrify.h index 207d50c710..e1165ea38e 100644 --- a/contrib/tools/python3/src/Objects/stringlib/transmogrify.h +++ b/contrib/tools/python3/src/Objects/stringlib/transmogrify.h @@ -5,13 +5,13 @@ /* the more complicated methods. parts of these should be pulled out into the shared code in bytes_methods.c to cut down on duplicate code bloat. */ -/*[clinic input] -class B "PyObject *" "&PyType_Type" -[clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=2935558188d97c76]*/ - -#include "clinic/transmogrify.h.h" - +/*[clinic input] +class B "PyObject *" "&PyType_Type" +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=2935558188d97c76]*/ + +#include "clinic/transmogrify.h.h" + static inline PyObject * return_self(PyObject *self) { @@ -24,19 +24,19 @@ return_self(PyObject *self) return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); } -/*[clinic input] -B.expandtabs as stringlib_expandtabs - - tabsize: int = 8 - -Return a copy where all tab characters are expanded using spaces. - -If tabsize is not given, a tab size of 8 characters is assumed. -[clinic start generated code]*/ - -static PyObject * -stringlib_expandtabs_impl(PyObject *self, int tabsize) -/*[clinic end generated code: output=069cb7fae72e4c2b input=3c6d3b12aa3ccbea]*/ +/*[clinic input] +B.expandtabs as stringlib_expandtabs + + tabsize: int = 8 + +Return a copy where all tab characters are expanded using spaces. + +If tabsize is not given, a tab size of 8 characters is assumed. +[clinic start generated code]*/ + +static PyObject * +stringlib_expandtabs_impl(PyObject *self, int tabsize) +/*[clinic end generated code: output=069cb7fae72e4c2b input=3c6d3b12aa3ccbea]*/ { const char *e, *p; char *q; @@ -131,21 +131,21 @@ pad(PyObject *self, Py_ssize_t left, Py_ssize_t right, char fill) return u; } -/*[clinic input] -B.ljust as stringlib_ljust - - width: Py_ssize_t - fillchar: char = b' ' - / - -Return a left-justified string of length width. - -Padding is done using the specified fill character. -[clinic start generated code]*/ - +/*[clinic input] +B.ljust as stringlib_ljust + + width: Py_ssize_t + fillchar: char = b' ' + / + +Return a left-justified string of length width. + +Padding is done using the specified fill character. +[clinic start generated code]*/ + static PyObject * -stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar) -/*[clinic end generated code: output=c79ca173c5ff8337 input=eff2d014bc7d80df]*/ +stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar) +/*[clinic end generated code: output=c79ca173c5ff8337 input=eff2d014bc7d80df]*/ { if (STRINGLIB_LEN(self) >= width) { return return_self(self); @@ -155,21 +155,21 @@ stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar) } -/*[clinic input] -B.rjust as stringlib_rjust - - width: Py_ssize_t - fillchar: char = b' ' - / - -Return a right-justified string of length width. - -Padding is done using the specified fill character. -[clinic start generated code]*/ - +/*[clinic input] +B.rjust as stringlib_rjust + + width: Py_ssize_t + fillchar: char = b' ' + / + +Return a right-justified string of length width. + +Padding is done using the specified fill character. +[clinic start generated code]*/ + static PyObject * -stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar) -/*[clinic end generated code: output=7df5d728a5439570 input=218b0bd31308955d]*/ +stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar) +/*[clinic end generated code: output=7df5d728a5439570 input=218b0bd31308955d]*/ { if (STRINGLIB_LEN(self) >= width) { return return_self(self); @@ -179,21 +179,21 @@ stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar) } -/*[clinic input] -B.center as stringlib_center - - width: Py_ssize_t - fillchar: char = b' ' - / - -Return a centered string of length width. - -Padding is done using the specified fill character. -[clinic start generated code]*/ - +/*[clinic input] +B.center as stringlib_center + + width: Py_ssize_t + fillchar: char = b' ' + / + +Return a centered string of length width. + +Padding is done using the specified fill character. +[clinic start generated code]*/ + static PyObject * -stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar) -/*[clinic end generated code: output=d8da2e055288b4c2 input=3776fd278765d89b]*/ +stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar) +/*[clinic end generated code: output=d8da2e055288b4c2 input=3776fd278765d89b]*/ { Py_ssize_t marg, left; @@ -207,20 +207,20 @@ stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar) return pad(self, left, marg - left, fillchar); } -/*[clinic input] -B.zfill as stringlib_zfill - - width: Py_ssize_t - / - -Pad a numeric string with zeros on the left, to fill a field of the given width. - -The original string is never truncated. -[clinic start generated code]*/ - +/*[clinic input] +B.zfill as stringlib_zfill + + width: Py_ssize_t + / + +Pad a numeric string with zeros on the left, to fill a field of the given width. + +The original string is never truncated. +[clinic start generated code]*/ + static PyObject * -stringlib_zfill_impl(PyObject *self, Py_ssize_t width) -/*[clinic end generated code: output=0b3c684a7f1b2319 input=2da6d7b8e9bcb19a]*/ +stringlib_zfill_impl(PyObject *self, Py_ssize_t width) +/*[clinic end generated code: output=0b3c684a7f1b2319 input=2da6d7b8e9bcb19a]*/ { Py_ssize_t fill; PyObject *s; @@ -680,13 +680,13 @@ stringlib_replace(PyObject *self, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) { - if (STRINGLIB_LEN(self) < from_len) { - /* nothing to do; return the original bytes */ - return return_self(self); - } + if (STRINGLIB_LEN(self) < from_len) { + /* nothing to do; return the original bytes */ + return return_self(self); + } if (maxcount < 0) { maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0) { + } else if (maxcount == 0) { /* nothing to do; return the original bytes */ return return_self(self); } diff --git a/contrib/tools/python3/src/Objects/stringlib/unicode_format.h b/contrib/tools/python3/src/Objects/stringlib/unicode_format.h index 21787b3270..b526ad21b8 100644 --- a/contrib/tools/python3/src/Objects/stringlib/unicode_format.h +++ b/contrib/tools/python3/src/Objects/stringlib/unicode_format.h @@ -440,13 +440,13 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs, /* look up in args */ obj = PySequence_GetItem(args, index); - if (obj == NULL) { - PyErr_Format(PyExc_IndexError, - "Replacement index %zd out of range for positional " - "args tuple", - index); - goto error; - } + if (obj == NULL) { + PyErr_Format(PyExc_IndexError, + "Replacement index %zd out of range for positional " + "args tuple", + index); + goto error; + } } /* iterate over the rest of the field_name */ @@ -828,7 +828,7 @@ output_markup(SubString *field_name, SubString *format_spec, tmp = NULL; } - /* if needed, recursively compute the format_spec */ + /* if needed, recursively compute the format_spec */ if (format_spec_needs_expanding) { tmp = build_string(format_spec, args, kwargs, recursion_depth-1, auto_number); @@ -1071,10 +1071,10 @@ static PyTypeObject PyFormatterIter_Type = { 0, /* tp_itemsize */ /* methods */ (destructor)formatteriter_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ + 0, /* tp_vectorcall_offset */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_as_async */ + 0, /* tp_as_async */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -1207,10 +1207,10 @@ static PyTypeObject PyFieldNameIter_Type = { 0, /* tp_itemsize */ /* methods */ (destructor)fieldnameiter_dealloc, /* tp_dealloc */ - 0, /* tp_vectorcall_offset */ + 0, /* tp_vectorcall_offset */ 0, /* tp_getattr */ 0, /* tp_setattr */ - 0, /* tp_as_async */ + 0, /* tp_as_async */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ |