]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-143689: Fix BufferedReader.read1 leaving object in reentrant state on error (...
authorYongtao Huang <yongtaoh2022@gmail.com>
Mon, 19 Jan 2026 14:09:30 +0000 (22:09 +0800)
committerGitHub <noreply@github.com>
Mon, 19 Jan 2026 14:09:30 +0000 (15:09 +0100)
commit375e372c6661d818b85d1405c5ba681a06988ebd
tree54575154c9689ef95a7460e9845a46f69747d7e2
parent72bacb0cd0882bce6bd7e9e2e4e9c112d70213e7
gh-143689: Fix BufferedReader.read1 leaving object in reentrant state on error (#143690)

BufferedReader.read1() could leave the buffered object in a
reentrant (locked) state when an exception was raised while
allocating the output buffer.

This change ensures the internal buffered lock is always released
on error, keeping the object in a consistent state after failures.

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_io/test_bufferedio.py
Misc/NEWS.d/next/Library/2026-01-11-14-14-19.gh-issue-143689.fzHJ2W.rst [new file with mode: 0644]
Modules/_io/bufferedio.c