Skip to content

gh-135410: Fix test_memoryio refleak buildbots #135430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Lib/test/test_memoryio.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,22 +725,6 @@ def test_newline_argument(self):
for newline in (None, "", "\n", "\r", "\r\n"):
self.ioclass(newline=newline)

@unittest.skipUnless(support.Py_GIL_DISABLED, "only meaningful under free-threading")
@threading_helper.requires_working_threading()
def test_concurrent_use(self):
memio = self.ioclass("")

def use():
memio.write("x" * 10)
memio.readlines()

threads = [threading.Thread(target=use) for _ in range(8)]
with threading_helper.catch_threading_exception() as cm:
with threading_helper.start_threads(threads):
pass

self.assertIsNone(cm.exc_value)


class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin,
TextIOTestMixin, unittest.TestCase):
Expand Down Expand Up @@ -907,6 +891,22 @@ def test_setstate(self):
memio.close()
self.assertRaises(ValueError, memio.__setstate__, ("closed", "", 0, None))

@unittest.skipUnless(support.Py_GIL_DISABLED, "only meaningful under free-threading")
@threading_helper.requires_working_threading()
def test_concurrent_use(self):
memio = self.ioclass("")

def use():
memio.write("x" * 10)
memio.readlines()

threads = [threading.Thread(target=use) for _ in range(8)]
with threading_helper.catch_threading_exception() as cm:
with threading_helper.start_threads(threads):
pass

if cm.exc_value is not None:
raise cm.exc_value


class CStringIOPickleTest(PyStringIOPickleTest):
Expand Down
Loading