Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 157f83f

Browse files
author
Victor Stinner
committed
Strip trailing spaces in unicodeobject.[ch]
1 parent 6c7a52a commit 157f83f

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

Include/unicodeobject.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,13 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
356356
#define PyUnicode_IS_COMPACT(op) \
357357
(((PyASCIIObject*)(op))->state.compact)
358358

359-
/* Return one of the PyUnicode_*_KIND values defined above. */
359+
/* Return one of the PyUnicode_*_KIND values defined above. */
360360
#define PyUnicode_KIND(op) \
361361
(assert(PyUnicode_Check(op)), \
362362
assert(PyUnicode_IS_READY(op)), \
363363
((PyASCIIObject *)(op))->state.kind)
364364

365-
/* Return a void pointer to the raw unicode buffer. */
365+
/* Return a void pointer to the raw unicode buffer. */
366366
#define _PyUnicode_COMPACT_DATA(op) \
367367
(PyUnicode_IS_COMPACT_ASCII(op) ? \
368368
((void*)((PyASCIIObject*)(op) + 1)) : \
@@ -509,7 +509,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_New(
509509

510510
/* Initializes the canonical string representation from a the deprected
511511
wstr/Py_UNICODE representation. This function is used to convert
512-
unicode objects which were created using the old API to the new flexible
512+
unicode objects which were created using the old API to the new flexible
513513
format introduced with PEP 393. The PyUnicode_READY() macro can be
514514
more efficient if the string is already ready. */
515515
#ifndef Py_LIMITED_API
@@ -641,7 +641,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(
641641
PyObject *unicode
642642
);
643643

644-
/* Get the number of Py_UNICODE units in the
644+
/* Get the number of Py_UNICODE units in the
645645
string representation. */
646646

647647
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
@@ -857,7 +857,7 @@ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
857857
858858
In case of an error, no *size is set.
859859
860-
This funcation caches the UTF-8 encoded string in the unicodeobject
860+
This funcation caches the UTF-8 encoded string in the unicodeobject
861861
and subsequent calls will return the same string. The memory is relased
862862
when the unicodeobject is deallocated.
863863

Objects/unicodeobject.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
643643
PyUnicode_KIND_SIZE(to_kind, how_many));
644644
return how_many;
645645
}
646-
646+
647647
if (from_kind > to_kind) {
648648
/* slow path to check for character overflow */
649649
const Py_UCS4 to_maxchar = PyUnicode_MAX_CHAR_VALUE(to);
@@ -678,7 +678,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
678678
);
679679
return how_many;
680680
}
681-
else if (from_kind == PyUnicode_1BYTE_KIND
681+
else if (from_kind == PyUnicode_1BYTE_KIND
682682
&& to_kind == PyUnicode_4BYTE_KIND)
683683
{
684684
_PyUnicode_CONVERT_BYTES(
@@ -703,7 +703,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
703703
PyErr_Format(PyExc_ValueError,
704704
"Cannot copy UCS%u characters "
705705
"into a string of UCS%u characters",
706-
1 << (from_kind - 1),
706+
1 << (from_kind - 1),
707707
1 << (to_kind -1));
708708
return -1;
709709
}
@@ -8155,8 +8155,8 @@ fixup(PyUnicodeObject *self,
81558155
/* If the maxchar increased so that the kind changed, not all
81568156
characters are representable anymore and we need to fix the
81578157
string again. This only happens in very few cases. */
8158-
if (PyUnicode_CopyCharacters(v, 0,
8159-
(PyObject*)self, 0,
8158+
if (PyUnicode_CopyCharacters(v, 0,
8159+
(PyObject*)self, 0,
81608160
PyUnicode_GET_LENGTH(self)) < 0)
81618161
{
81628162
Py_DECREF(u);
@@ -8166,8 +8166,8 @@ fixup(PyUnicodeObject *self,
81668166
assert(maxchar_old > 0 && maxchar_old <= maxchar_new);
81678167
}
81688168
else {
8169-
if (PyUnicode_CopyCharacters(v, 0,
8170-
u, 0,
8169+
if (PyUnicode_CopyCharacters(v, 0,
8170+
u, 0,
81718171
PyUnicode_GET_LENGTH(self)) < 0)
81728172
{
81738173
Py_DECREF(u);
@@ -8558,8 +8558,8 @@ pad(PyUnicodeObject *self,
85588558
FILL(kind, data, fill, 0, left);
85598559
if (right)
85608560
FILL(kind, data, fill, left + _PyUnicode_LENGTH(self), right);
8561-
if (PyUnicode_CopyCharacters(u, left,
8562-
(PyObject*)self, 0,
8561+
if (PyUnicode_CopyCharacters(u, left,
8562+
(PyObject*)self, 0,
85638563
_PyUnicode_LENGTH(self)) < 0)
85648564
{
85658565
Py_DECREF(u);
@@ -9479,7 +9479,7 @@ PyUnicode_Concat(PyObject *left, PyObject *right)
94799479
goto onError;
94809480
if (PyUnicode_CopyCharacters(w, 0, u, 0, PyUnicode_GET_LENGTH(u)) < 0)
94819481
goto onError;
9482-
if (PyUnicode_CopyCharacters(w, PyUnicode_GET_LENGTH(u),
9482+
if (PyUnicode_CopyCharacters(w, PyUnicode_GET_LENGTH(u),
94839483
v, 0,
94849484
PyUnicode_GET_LENGTH(v)) < 0)
94859485
goto onError;

0 commit comments

Comments
 (0)