From d861c35c969a948834859cf66cf1dd74cfa7ec3c Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Mon, 21 Oct 2024 09:21:35 +0200 Subject: [PATCH] apply review suggestions --- Lib/test/test_free_threading/test_enumerate.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_free_threading/test_enumerate.py b/Lib/test/test_free_threading/test_enumerate.py index 02aa096ae0fda5..bcc6588d34fca5 100644 --- a/Lib/test/test_free_threading/test_enumerate.py +++ b/Lib/test/test_free_threading/test_enumerate.py @@ -6,14 +6,6 @@ class EnumerateThreading(unittest.TestCase): - @staticmethod - def work(enum, start): - while True: - try: - value = next(enum) - except StopIteration: - break - @threading_helper.reap_threads @threading_helper.requires_working_threading() @@ -23,12 +15,19 @@ def test_threading(self): n = 100 start = sys.maxsize - 40 + def work(enum, start): + while True: + try: + _ = next(enum) + except StopIteration: + break + for _ in range(number_of_iterations): enum = enumerate(range(start, start + n)) worker_threads = [] for ii in range(number_of_threads): worker_threads.append( - Thread(target=self.work, args=[enum, start])) + Thread(target=work, args=[enum, start])) for t in worker_threads: t.start() for t in worker_threads: