@@ -14332,6 +14332,8 @@ search_longest_common_leading_whitespace(
1433214332 // scan the whole line
1433314333 while (iter < end && * iter != '\n' ) {
1433414334 if (!leading_whitespace_end && !Py_ISSPACE (Py_CHARMASK (* iter ))) {
14335+ /* `iter` points to the first non-whitespace character
14336+ in this line */
1433514337 if (iter == line_start ) {
1433614338 // some line has no indent, fast exit!
1433714339 return 0 ;
@@ -14408,7 +14410,7 @@ _PyUnicode_Dedent(PyObject *unicode)
1440814410 // [whitespace_start, whitespace_start + whitespace_len)
1440914411 // describes the current longest common leading whitespace
1441014412 const char * whitespace_start = NULL ;
14411- const Py_ssize_t whitespace_len = search_longest_common_leading_whitespace (
14413+ Py_ssize_t whitespace_len = search_longest_common_leading_whitespace (
1441214414 src , end , & whitespace_start );
1441314415
1441414416 // now we should trigger a dedent
@@ -14432,7 +14434,7 @@ _PyUnicode_Dedent(PyObject *unicode)
1443214434 }
1443314435
1443414436 // invariant: *iter == '\n' or iter == end
14435- const bool append_newline = iter < end ;
14437+ bool append_newline = iter < end ;
1443614438
1443714439 // if this line has all white space, write '\n' and continue
1443814440 if (in_leading_space ) {
@@ -14444,7 +14446,7 @@ _PyUnicode_Dedent(PyObject *unicode)
1444414446
1444514447 /* copy [new_line_start + whitespace_len, iter) to buffer, then
1444614448 conditionally append '\n' */
14447- const Py_ssize_t new_line_len = iter - line_start - whitespace_len ;
14449+ Py_ssize_t new_line_len = iter - line_start - whitespace_len ;
1444814450 assert (new_line_len >= 0 );
1444914451 memcpy (dest_iter , line_start + whitespace_len , new_line_len );
1445014452
0 commit comments