File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Lib/test/test_free_threading Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 11import unittest
2- import concurrent .futures
32
43from unittest import TestCase
54
65from test .support import threading_helper
76
87@threading_helper .requires_working_threading ()
98class TestGen (TestCase ):
10- def test_generators_basic (self ):
9+ def test_generator_send (self ):
10+ import threading
11+
1112 def gen ():
1213 for _ in range (5000 ):
1314 yield
1415
1516
1617 it = gen ()
17- with concurrent .futures .ThreadPoolExecutor () as executor :
18- for _ in range (5000 ):
19- executor .submit (lambda : next (it ))
18+ with threading_helper .catch_threading_exception () as cm :
19+ # next(it) is equivalent to it.send(None)
20+ with threading_helper .start_threads (
21+ (threading .Thread (target = lambda : next (it )) for _ in range (10 ))
22+ ):
23+ pass
24+
25+ self .assertIsNone (cm .exc_value )
2026
2127
2228if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments