]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-149816: add missing critical section on self in buffered_iternext (GH-15029...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 23 May 2026 09:26:44 +0000 (11:26 +0200)
committerGitHub <noreply@github.com>
Sat, 23 May 2026 09:26:44 +0000 (14:56 +0530)
gh-149816: add missing critical section on self in buffered_iternext (GH-150295)
(cherry picked from commit e8545ed3eafbf349b51ea308126a67dc70416a62)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Modules/_io/bufferedio.c

index 6b43161a73a610a8e07d9679d9f69189d53a2af3..50769e419303fe9ca81cd9cadcf5a7bebc766670 100644 (file)
@@ -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,