File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1616imp  =  warnings_helper .import_deprecated ('imp' )
1717import  _imp 
1818import  _testinternalcapi 
19- import  _xxsubinterpreters  as  _interpreters 
19+ try :
20+     import  _xxsubinterpreters  as  _interpreters 
21+ except  ModuleNotFoundError :
22+     _interpreters  =  None 
2023
2124
2225OS_PATH_NAME  =  os .path .__name__ 
2326
2427
28+ def  requires_subinterpreters (meth ):
29+     """Decorator to skip a test if subinterpreters are not supported.""" 
30+     return  unittest .skipIf (_interpreters  is  None ,
31+                            'subinterpreters required' )(meth )
32+ 
33+ 
2534def  requires_load_dynamic (meth ):
2635    """Decorator to skip a test if not running under CPython or lacking 
2736    imp.load_dynamic().""" 
@@ -254,6 +263,7 @@ def test_issue16421_multiple_modules_in_one_dll(self):
254263        with  self .assertRaises (ImportError ):
255264            imp .load_dynamic ('nonexistent' , pathname )
256265
266+     @requires_subinterpreters  
257267    @requires_load_dynamic  
258268    def  test_singlephase_multiple_interpreters (self ):
259269        # Currently, for every single-phrase init module loaded 
Original file line number Diff line number Diff line change @@ -197,13 +197,15 @@ gilstate_tss_clear(_PyRuntimeState *runtime)
197197}
198198
199199
200+ #ifndef  NDEBUG 
200201static  inline  int  tstate_is_alive (PyThreadState  * tstate );
201202
202203static  inline  int 
203204tstate_is_bound (PyThreadState  * tstate )
204205{
205206    return  tstate -> _status .bound  &&  !tstate -> _status .unbound ;
206207}
208+ #endif   // !NDEBUG 
207209
208210static  void  bind_gilstate_tstate (PyThreadState  * );
209211static  void  unbind_gilstate_tstate (PyThreadState  * );
@@ -1119,6 +1121,7 @@ _PyInterpreterState_LookUpID(int64_t requested_id)
11191121/* the per-thread runtime state */ 
11201122/********************************/ 
11211123
1124+ #ifndef  NDEBUG 
11221125static  inline  int 
11231126tstate_is_alive (PyThreadState  * tstate )
11241127{
@@ -1127,6 +1130,7 @@ tstate_is_alive(PyThreadState *tstate)
11271130            !tstate -> _status .cleared  && 
11281131            !tstate -> _status .finalizing );
11291132}
1133+ #endif 
11301134
11311135
11321136//---------- 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments