Skip to content
Closed
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
pep8
  • Loading branch information
eendebakpt committed Jun 16, 2024
commit 98f72e61393f6812c86fe3d4177c1c8ecfdeb835
10 changes: 6 additions & 4 deletions Lib/test/test_enumerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import pickle
import gc
import threading
from threading import Thread

from test import support

Expand Down Expand Up @@ -295,7 +295,7 @@ def enum(self, iterable, start=sys.maxsize + 1):

class EnumerateThreading(unittest.TestCase):
@staticmethod
def work(index, enum, start):
def work(enum, start):
while True:
try:
value = next(enum)
Expand All @@ -309,8 +309,10 @@ def test_threading(self):
number_of_threads = 4
n = 100
start = sys.maxsize-10
enum = enumerate(range(start, start+n))
worker_threads = [threading.Thread(target=self.work, args=[ii, enum, start]) for ii in range(number_of_threads)]
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]))
_ = [t.start() for t in worker_threads]
_ = [t.join() for t in worker_threads]

Expand Down