8000 gh-127740: Improve code, consolidate two variables into one · srinivasreddy/cpython@f3bfe85 · GitHub
[go: up one dir, main page]

10000 Skip to content

Commit f3bfe85

Browse files
committed
pythongh-127740: Improve code, consolidate two variables into one
1 parent 14b7d5e commit f3bfe85

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Objects/bytesobject.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,10 +2516,9 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25162516
}
25172517

25182518
assert(PyUnicode_KIND(string) == PyUnicode_1BYTE_KIND);
2519-
2520-
const Py_UCS1 *s = PyUnicode_1BYTE_DATA(string);
2519+
str = PyUnicode_1BYTE_DATA(string);
25212520
for (Py_ssize_t i = 0; i < hexlen; i++) {
2522-
if (!Py_ISSPACE(s[i])) {
2521+
if (!Py_ISSPACE(str[i])) {
25232522
real_len++;
25242523
}
25252524
}
@@ -2529,7 +2528,6 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25292528
_PyBytesWriter_Dealloc(&writer);
25302529
return NULL;
25312530
}
2532-
str = PyUnicode_1BYTE_DATA(string);
25332531

25342532
/* This overestimates if there are spaces */
25352533
buf = _PyBytesWriter_Alloc(&writer, hexlen / 2);

0 commit comments

Comments
 (0)
0