Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d861c35

Browse files
committed
apply review suggestions
1 parent 0dd6cd8 commit d861c35

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

Lib/test/test_free_threading/test_enumerate.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66

77

88
class EnumerateThreading(unittest.TestCase):
9-
@staticmethod
10-
def work(enum, start):
11-
while True:
12-
try:
13-
value = next(enum)
14-
except StopIteration:
15-
break
16-
179

1810
@threading_helper.reap_threads
1911
@threading_helper.requires_working_threading()
@@ -23,12 +15,19 @@ def test_threading(self):
2315
n = 100
2416
start = sys.maxsize - 40
2517

18+
def work(enum, start):
19+
while True:
20+
try:
21+
_ = next(enum)
22+
except StopIteration:
23+
break
24+
2625
for _ in range(number_of_iterations):
2726
enum = enumerate(range(start, start + n))
2827
worker_threads = []
2928
for ii in range(number_of_threads):
3029
worker_threads.append(
31-
Thread(target=self.work, args=[enum, start]))
30+
Thread(target=work, args=[enum, start]))
3231
for t in worker_threads:
3332
t.start()
3433
for t in worker_threads:

0 commit comments

Comments
 (0)