@@ -1560,9 +1560,7 @@ def callback():
15601560            #try submitting callback until successful. 
15611561            #rely on regular interrupt to flush queue if we are 
15621562            #unsuccessful. 
1563-             while  True :
1564-                 if  _testcapi ._pending_threadfunc (callback ):
1565-                     break 
1563+             self .assertTrue (_testcapi ._pending_threadfunc (callback ))
15661564
15671565    def  pendingcalls_submit (self , l , n , * , main = True ):
15681566        def  callback ():
@@ -1633,51 +1631,11 @@ def test_main_pendingcalls_non_threaded(self):
16331631        #again, just using the main thread, likely they will all be dispatched at 
16341632        #once.  It is ok to ask for too many, because we loop until we find a slot. 
16351633        #the loop can be interrupted to dispatch. 
1636-         #there are only 32 dispatch slots, so we go for twice that! 
16371634        l  =  []
16381635        n  =  64 
16391636        self .main_pendingcalls_submit (l , n )
16401637        self .pendingcalls_wait (l , n )
16411638
1642-     def  test_max_pending (self ):
1643-         with  self .subTest ('main-only' ):
1644-             maxpending  =  32 
1645- 
1646-             l  =  []
1647-             added  =  self .pendingcalls_submit (l , 1 , main = True )
1648-             self .pendingcalls_wait (l , added )
1649-             self .assertEqual (added , 1 )
1650- 
1651-             l  =  []
1652-             added  =  self .pendingcalls_submit (l , maxpending , main = True )
1653-             self .pendingcalls_wait (l , added )
1654-             self .assertEqual (added , maxpending )
1655- 
1656-             l  =  []
1657-             added  =  self .pendingcalls_submit (l , maxpending + 1 , main = True )
1658-             self .pendingcalls_wait (l , added )
1659-             self .assertEqual (added , maxpending )
1660- 
1661-         with  self .subTest ('not main-only' ):
1662-             # Per-interpreter pending calls has a much higher limit 
1663-             # on how many may be pending at a time. 
1664-             maxpending  =  300 
1665- 
1666-             l  =  []
1667-             added  =  self .pendingcalls_submit (l , 1 , main = False )
1668-             self .pendingcalls_wait (l , added )
1669-             self .assertEqual (added , 1 )
1670- 
1671-             l  =  []
1672-             added  =  self .pendingcalls_submit (l , maxpending , main = False )
1673-             self .pendingcalls_wait (l , added )
1674-             self .assertEqual (added , maxpending )
1675- 
1676-             l  =  []
1677-             added  =  self .pendingcalls_submit (l , 1000 , main = False )
1678-             self .pendingcalls_wait (l , added )
1679-             self .assertEqual (added , maxpending )
1680- 
16811639    class  PendingTask (types .SimpleNamespace ):
16821640
16831641        _add_pending  =  _testinternalcapi .pending_threadfunc 
@@ -1711,10 +1669,10 @@ def callback():
17111669                # the eval breaker, so we take a naive approach to 
17121670                # make sure. 
17131671                if  threading .get_ident () not  in worker_tids :
1714-                     self ._add_pending (callback ,  ensure_added = True )
1672+                     self ._add_pending (callback )
17151673                    return 
17161674                self .run ()
1717-             self ._add_pending (callback ,  ensure_added = True )
1675+             self ._add_pending (callback )
17181676
17191677        def  create_thread (self , worker_tids ):
17201678            return  threading .Thread (
0 commit comments