[3.11] gh-111942: Remove an extra incref in textiowrapper_change_encoding #126542
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.
A recent test fix uncovered a refleak that went in 3.11 on November due to a Git mis-merge.
So, @pablogsal, here's a RM decision for you. (Not time-sensitive, of course.)
This is not a security issue, but it should fix failing buildbots. (The other way to fix them would be to revert the change that uncovered the issue, which would mean we probably won't notice future refleaks in
test_io
.)There's an issue with the 3.11 backport commit e2421a3 The change for the main branch was:
but in 3.11 this became:
+ Py_INCREF(errors); ... Py_INCREF(errors); Py_SETREF(self->encoding, encoding); Py_SETREF(self->errors, errors);
i.e. there's an extra incref, but it looks -- at least to Git -- like the change that removes
Py_NewRef
was already applied.This was not caught because
test_io
refleaks tests were ineffective on 3.11 (see #126478 (comment)).Remove the extraneous incref.