File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed 
Lib/test/test_concurrent_futures Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,16 @@ def pipe(self):
5656        return  r , w 
5757
5858
59+ class  Shenanigans :
60+     """Succeeds with pickle.dumps(), but fails with pickle.loads()""" 
61+     def  __init__ (self , value ):
62+         if  value  ==  1 :
63+             raise  RuntimeError ("gotcha" )
64+ 
65+     def  __reduce__ (self ):
66+         return  (self .__class__ , (1 ,))
67+ 
68+ 
5969class  InterpreterPoolExecutorTest (
6070            InterpretersMixin , ExecutorTest , BaseTestCase ):
6171
@@ -279,6 +289,14 @@ def test_idle_thread_reuse(self):
279289        self .assertEqual (len (executor ._threads ), 1 )
280290        executor .shutdown (wait = True )
281291
292+     def  test_pickle_errors_propagate (self ):
293+         # GH-125864: Pickle errors happen before the script tries to execute, so the 
294+         # queue used to wait infinitely. 
295+ 
296+         fut  =  self .executor .submit (Shenanigans (0 ))
297+         with  self .assertRaisesRegex (RuntimeError , "gotcha" ):
298+             fut .result ()
299+ 
282300
283301class  AsyncioTest (InterpretersMixin , testasyncio_utils .TestCase ):
284302
@@ -351,6 +369,7 @@ def test_default_executor(self):
351369        self .assertNotEqual (interpid , unexpected )
352370
353371
372+ 
354373def  setUpModule ():
355374    setup_module ()
356375
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments