File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed 
Lib/test/test_interpreters Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 77
88from  test  import  support 
99from  test .support  import  import_helper 
10+ from  test .support .script_helper  import  assert_python_ok 
1011# Raise SkipTest if subinterpreters not supported. 
1112_interpreters  =  import_helper .import_module ('_interpreters' )
1213from  test .support  import  Py_GIL_DISABLED 
@@ -675,6 +676,13 @@ def task():
675676        self .assertEqual (os .read (r_interp , 1 ), FINISHED )
676677
677678    def  test_remaining_daemon_threads (self ):
679+         # Daemon threads leak reference by nature, because they hang threads 
680+         # without allowing them to do cleanup (i.e., release refs). 
681+         # To prevent that from messing up the refleak hunter and whatnot, we 
682+         # run this in a subprocess. 
683+         code  =  '''if True: 
684+         import _interpreters 
685+         import types 
678686        interp = _interpreters.create( 
679687            types.SimpleNamespace( 
680688                use_main_obmalloc=False, 
@@ -698,6 +706,8 @@ def task():
698706                t.start() 
699707            """) 
700708        _interpreters.destroy(interp) 
709+         ''' 
710+         assert_python_ok ('-c' , code )
701711
702712
703713class  TestInterpreterPrepareMain (TestBase ):
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments