Skip to content

Commit 7343135

Browse files
Revert "gh-135410: use a critical section around StringIO.__next__ (#135412)" (#135439)
This reverts commit e6c3039.
1 parent b03309f commit 7343135

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

Lib/test/test_memoryio.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55

66
import unittest
77
from test import support
8-
from test.support import threading_helper
98

109
import gc
1110
import io
1211
import _pyio as pyio
1312
import pickle
1413
import sys
1514
import weakref
16-
import threading
1715

1816
class IntLike:
1917
def __init__(self, num):
@@ -725,22 +723,6 @@ def test_newline_argument(self):
725723
for newline in (None, "", "\n", "\r", "\r\n"):
726724
self.ioclass(newline=newline)
727725

728-
@unittest.skipUnless(support.Py_GIL_DISABLED, "only meaningful under free-threading")
729-
@threading_helper.requires_working_threading()
730-
def test_concurrent_use(self):
731-
memio = self.ioclass("")
732-
733-
def use():
734-
memio.write("x" * 10)
735-
memio.readlines()
736-
737-
threads = [threading.Thread(target=use) for _ in range(8)]
738-
with threading_helper.catch_threading_exception() as cm:
739-
with threading_helper.start_threads(threads):
740-
pass
741-
742-
self.assertIsNone(cm.exc_value)
743-
744726

745727
class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin,
746728
TextIOTestMixin, unittest.TestCase):
@@ -908,7 +890,6 @@ def test_setstate(self):
908890
self.assertRaises(ValueError, memio.__setstate__, ("closed", "", 0, None))
909891

910892

911-
912893
class CStringIOPickleTest(PyStringIOPickleTest):
913894
UnsupportedOperation = io.UnsupportedOperation
914895

Misc/NEWS.d/next/Library/2025-06-11-19-05-49.gh-issue-135410.E89Boi.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

Modules/_io/stringio.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ _io_StringIO_readline_impl(stringio *self, Py_ssize_t size)
404404
}
405405

406406
static PyObject *
407-
stringio_iternext_lock_held(PyObject *op)
407+
stringio_iternext(PyObject *op)
408408
{
409409
PyObject *line;
410410
stringio *self = stringio_CAST(op);
@@ -441,16 +441,6 @@ stringio_iternext_lock_held(PyObject *op)
441441
return line;
442442
}
443443

444-
static PyObject *
445-
stringio_iternext(PyObject *op)
446-
{
447-
PyObject *res;
448-
Py_BEGIN_CRITICAL_SECTION(op);
449-
res = stringio_iternext_lock_held(op);
450-
Py_END_CRITICAL_SECTION();
451-
return res;
452-
}
453-
454444
/*[clinic input]
455445
@critical_section
456446
_io.StringIO.truncate

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy