Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
apply review suggestions
  • Loading branch information
eendebakpt committed Oct 21, 2024
commit d861c35c969a948834859cf66cf1dd74cfa7ec3c
17 changes: 8 additions & 9 deletions Lib/test/test_free_threading/test_enumerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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:
Expand Down