Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt committed Oct 21, 2024
1 parent 0dd6cd8 commit d861c35
Showing 1 changed file with 8 additions and 9 deletions.
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

0 comments on commit d861c35

Please sign in to comment.