]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149816: add missing critical section on self in buffered_iternext (#150295)
authorKumar Aditya <kumaraditya@python.org>
Sat, 23 May 2026 08:57:13 +0000 (14:27 +0530)
committerGitHub <noreply@github.com>
Sat, 23 May 2026 08:57:13 +0000 (08:57 +0000)
Modules/_io/bufferedio.c

index 0fdae7b2d210040bb7ab28db6f7c684388291088..5537947f6a51c113e0ba86460834464c282a305d 100644 (file)
@@ -1509,7 +1509,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,