From 2d94a6e85ed6b72e0ef19b72d41b8db32e04212a Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 23 May 2026 11:26:44 +0200 Subject: [PATCH] [3.14] gh-149816: add missing critical section on self in buffered_iternext (GH-150295) (#150306) gh-149816: add missing critical section on self in buffered_iternext (GH-150295) (cherry picked from commit e8545ed3eafbf349b51ea308126a67dc70416a62) Co-authored-by: Kumar Aditya --- Modules/_io/bufferedio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 6b43161a73a6..50769e419303 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1497,7 +1497,9 @@ buffered_iternext(PyObject *op) tp == state->PyBufferedRandom_Type) { /* Skip method call overhead for speed */ + Py_BEGIN_CRITICAL_SECTION(self); line = _buffered_readline(self, -1); + Py_END_CRITICAL_SECTION(); } else { line = PyObject_CallMethodNoArgs((PyObject *)self, -- 2.47.3