Repository navigation
Remove dead stores to 'size' in UTF-8 decoder (unicodeobject.c) - #140637
Merged
Merged
Conversation
cmaloney
approved these changes
Oct 26, 2025
cmaloney
left a comment
Contributor
There was a problem hiding this comment.
This looks correct to me
Contributor
Author
|
@sobolevn Could you please review this PR? |
sobolevn
approved these changes
Oct 27, 2025
sobolevn
left a comment
Member
There was a problem hiding this comment.
Indeed, size is not used. Good catch!
|
Sorry, @ashm-dev and @sobolevn, I could not cleanly backport this to |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 27, 2025
…onGH-140637) (cherry picked from commit 7d70a14) Co-authored-by: Shamil <ashm.tech@proton.me>
|
GH-140658 is a backport of this pull request to the 3.14 branch. |
Member
|
@ashm-dev please, take a look at 3.13 backport :) |
sobolevn
pushed a commit
that referenced
this pull request
Oct 27, 2025
Contributor
Author
|
@sobolevn There is no need to backport to 3.13, as I have verified that this |
StanFromIreland
pushed a commit
to StanFromIreland/cpython
that referenced
this pull request
Dec 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove two dead assignments to size after advancing s in the UTF-8 decoding paths. The decoding logic uses s and end for bounds; size is not read after these points. No functional changes.
Details
Affected functions: unicode_decode_utf8() and unicode_decode_utf8_writer()
After s += pos/decoded, previous code also did size -= pos/decoded, but the remaining input is tracked via s < end and passed to unicode_decode_utf8_impl(..., s, end, ...).
Eliminates dead-store/unused-but-set warnings from static analyzers/compilers.
Behavior and performance are unchanged.
Notes