Skip to content

Commit 8e08bf8

Browse files
committed
[3.11] gh-111942: Remove an extra incref in textiowrapper_change_encoding
There's an issue with the 3.11 backport commit e2421a3 The chane for the main branch was: ```diff + Py_INCREF(errors); ... Py_SETREF(self->encoding, encoding); - Py_SETREF(self->errors, Py_NewRef(errors)); + Py_SETREF(self->errors, errors); ``` but in 3.11 this became: ```diff + 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.
1 parent 8c6885d commit 8e08bf8

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

Modules/_io/textio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,6 @@ textiowrapper_change_encoding(textio *self, PyObject *encoding,
13131313
}
13141314
Py_DECREF(codec_info);
13151315

1316-
Py_INCREF(errors);
13171316
Py_SETREF(self->encoding, encoding);
13181317
Py_SETREF(self->errors, errors);
13191318

0 commit comments

Comments
 (0)