Skip to content

Commit 86019c3

Browse files
committed
revert cosmetic changes
1 parent 5eca8d0 commit 86019c3

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

Objects/exceptions.c

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,53 +2995,56 @@ static PyObject *
29952995
UnicodeEncodeError_str(PyObject *self)
29962996
{
29972997
PyUnicodeErrorObject *exc = (PyUnicodeErrorObject *)self;
2998-
PyObject *res = NULL;
2998+
PyObject *result = NULL;
29992999
PyObject *reason_str = NULL;
30003000
PyObject *encoding_str = NULL;
30013001

3002-
if (exc->object == NULL) {
3002+
if (exc->object == NULL)
30033003
/* Not properly initialized. */
30043004
return PyUnicode_FromString("");
3005-
}
30063005

30073006
/* Get reason and encoding as strings, which they might not be if
30083007
they've been modified after we were constructed. */
30093008
reason_str = PyObject_Str(exc->reason);
3010-
if (reason_str == NULL) {
3009+
if (reason_str == NULL)
30113010
goto done;
3012-
}
30133011
encoding_str = PyObject_Str(exc->encoding);
3014-
if (encoding_str == NULL) {
3012+
if (encoding_str == NULL)
30153013
goto done;
3016-
}
30173014

30183015
Py_ssize_t len = PyUnicode_GET_LENGTH(exc->object);
30193016
Py_ssize_t start = exc->start, end = exc->end;
30203017

30213018
if ((start >= 0 && start < len) && (end >= 0 && end <= len) && end == start + 1) {
30223019
Py_UCS4 badchar = PyUnicode_ReadChar(exc->object, start);
30233020
const char *fmt;
3024-
if (badchar <= 0xff) {
3021+
if (badchar <= 0xff)
30253022
fmt = "'%U' codec can't encode character '\\x%02x' in position %zd: %U";
3026-
}
3027-
else if (badchar <= 0xffff) {
3023+
else if (badchar <= 0xffff)
30283024
fmt = "'%U' codec can't encode character '\\u%04x' in position %zd: %U";
3029-
}
3030-
else {
3025+
else
30313026
fmt = "'%U' codec can't encode character '\\U%08x' in position %zd: %U";
3032-
}
3033-
res = PyUnicode_FromFormat(fmt, encoding_str, (int)badchar, start, reason_str);
3027+
result = PyUnicode_FromFormat(
3028+
fmt,
3029+
encoding_str,
3030+
(int)badchar,
3031+
start,
3032+
reason_str
3033+
);
30343034
}
30353035
else {
3036-
res = PyUnicode_FromFormat(
3036+
result = PyUnicode_FromFormat(
30373037
"'%U' codec can't encode characters in position %zd-%zd: %U",
3038-
encoding_str, start, end - 1, reason_str
3038+
encoding_str,
3039+
start,
3040+
end - 1,
3041+
reason_str
30393042
);
30403043
}
30413044
done:
30423045
Py_XDECREF(reason_str);
30433046
Py_XDECREF(encoding_str);
3044-
return res;
3047+
return result;
30453048
}
30463049

30473050
static PyTypeObject _PyExc_UnicodeEncodeError = {
@@ -3110,46 +3113,49 @@ static PyObject *
31103113
UnicodeDecodeError_str(PyObject *self)
31113114
{
31123115
PyUnicodeErrorObject *exc = (PyUnicodeErrorObject *)self;
3113-
PyObject *res = NULL;
3116+
PyObject *result = NULL;
31143117
PyObject *reason_str = NULL;
31153118
PyObject *encoding_str = NULL;
31163119

3117-
if (exc->object == NULL) {
3120+
if (exc->object == NULL)
31183121
/* Not properly initialized. */
31193122
return PyUnicode_FromString("");
3120-
}
31213123

31223124
/* Get reason and encoding as strings, which they might not be if
31233125
they've been modified after we were constructed. */
31243126
reason_str = PyObject_Str(exc->reason);
3125-
if (reason_str == NULL) {
3127+
if (reason_str == NULL)
31263128
goto done;
3127-
}
31283129
encoding_str = PyObject_Str(exc->encoding);
3129-
if (encoding_str == NULL) {
3130+
if (encoding_str == NULL)
31303131
goto done;
3131-
}
31323132

31333133
Py_ssize_t len = PyBytes_GET_SIZE(exc->object);
31343134
Py_ssize_t start = exc->start, end = exc->end;
31353135

31363136
if ((start >= 0 && start < len) && (end >= 0 && end <= len) && end == start + 1) {
31373137
int badbyte = (int)(PyBytes_AS_STRING(exc->object)[start] & 0xff);
3138-
res = PyUnicode_FromFormat(
3138+
result = PyUnicode_FromFormat(
31393139
"'%U' codec can't decode byte 0x%02x in position %zd: %U",
3140-
encoding_str, badbyte, start, reason_str
3140+
encoding_str,
3141+
badbyte,
3142+
start,
3143+
reason_str
31413144
);
31423145
}
31433146
else {
3144-
res = PyUnicode_FromFormat(
3147+
result = PyUnicode_FromFormat(
31453148
"'%U' codec can't decode bytes in position %zd-%zd: %U",
3146-
encoding_str, start, end - 1, reason_str
3149+
encoding_str,
3150+
start,
3151+
end - 1,
3152+
reason_str
31473153
);
31483154
}
31493155
done:
31503156
Py_XDECREF(reason_str);
31513157
Py_XDECREF(encoding_str);
3152-
return res;
3158+
return result;
31533159
}
31543160

31553161
static PyTypeObject _PyExc_UnicodeDecodeError = {
@@ -3208,47 +3214,41 @@ static PyObject *
32083214
UnicodeTranslateError_str(PyObject *self)
32093215
{
32103216
PyUnicodeErrorObject *exc = (PyUnicodeErrorObject *)self;
3211-
PyObject *res = NULL;
3217+
PyObject *result = NULL;
32123218
PyObject *reason_str = NULL;
32133219

3214-
if (exc->object == NULL) {
3220+
if (exc->object == NULL)
32153221
/* Not properly initialized. */
32163222
return PyUnicode_FromString("");
3217-
}
32183223

32193224
/* Get reason as a string, which it might not be if it's been
32203225
modified after we were constructed. */
32213226
reason_str = PyObject_Str(exc->reason);
3222-
if (reason_str == NULL) {
3227+
if (reason_str == NULL)
32233228
goto done;
3224-
}
32253229

32263230
Py_ssize_t len = PyUnicode_GET_LENGTH(exc->object);
32273231
Py_ssize_t start = exc->start, end = exc->end;
32283232

32293233
if ((start >= 0 && start < len) && (end >= 0 && end <= len) && end == start + 1) {
32303234
Py_UCS4 badchar = PyUnicode_ReadChar(exc->object, start);
32313235
const char *fmt;
3232-
if (badchar <= 0xff) {
3236+
if (badchar <= 0xff)
32333237
fmt = "can't translate character '\\x%02x' in position %zd: %U";
3234-
}
3235-
else if (badchar <= 0xffff) {
3238+
else if (badchar <= 0xffff)
32363239
fmt = "can't translate character '\\u%04x' in position %zd: %U";
3237-
}
3238-
else {
3240+
else
32393241
fmt = "can't translate character '\\U%08x' in position %zd: %U";
3240-
}
3241-
res = PyUnicode_FromFormat(fmt, (int)badchar, start, reason_str);
3242-
}
3243-
else {
3244-
res = PyUnicode_FromFormat(
3242+
result = PyUnicode_FromFormat(fmt, (int)badchar, start, reason_str);
3243+
} else {
3244+
result = PyUnicode_FromFormat(
32453245
"can't translate characters in position %zd-%zd: %U",
32463246
start, end - 1, reason_str
32473247
);
32483248
}
32493249
done:
32503250
Py_XDECREF(reason_str);
3251-
return res;
3251+
return result;
32523252
}
32533253

32543254
static PyTypeObject _PyExc_UnicodeTranslateError = {

0 commit comments

Comments
 (0)