Skip to content

Conversation

@hyongtao-code
Copy link
Contributor

@hyongtao-code hyongtao-code commented Jan 11, 2026

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.

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>
Copy link
Contributor

@cmaloney cmaloney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! The fix looks correct. The NEWs entry and test don't quite match the preferred patterns in CPython, left some comments.

hyongtao-code and others added 2 commits January 12, 2026 06:30
…zHJ2W.rst

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
@hyongtao-code
Copy link
Contributor Author

The NEWs entry and test don't quite match the preferred patterns in CPython,

Thanks for the review and feedback — I’ve made the requested changes.

@cmaloney
Copy link
Contributor

Please don't force-push to CPython PR branches: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push

from collections import deque, UserList
from itertools import cycle, count
from test import support
from test.support import check_sanitizer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: combine with the test.support import just below this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants