mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	bpo-36710: Add PyInterpreterState.runtime field (GH-17270)
Add PyInterpreterState.runtime field: reference to the _PyRuntime global variable. This field exists to not have to pass runtime in addition to tstate to a function. Get runtime from tstate: tstate->interp->runtime. Remove "_PyRuntimeState *runtime" parameter from functions already taking a "PyThreadState *tstate" parameter. _PyGC_Init() first parameter becomes "PyThreadState *tstate".
This commit is contained in:
		
							parent
							
								
									eb1cbbff1c
								
							
						
					
					
						commit
						01b1cc12e7
					
				
					 8 changed files with 81 additions and 94 deletions
				
			
		| 
						 | 
				
			
			@ -1007,7 +1007,7 @@ t_bootstrap(void *boot_raw)
 | 
			
		|||
    runtime = boot->runtime;
 | 
			
		||||
    tstate = boot->tstate;
 | 
			
		||||
    tstate->thread_id = PyThread_get_thread_ident();
 | 
			
		||||
    _PyThreadState_Init(runtime, tstate);
 | 
			
		||||
    _PyThreadState_Init(tstate);
 | 
			
		||||
    PyEval_AcquireThread(tstate);
 | 
			
		||||
    tstate->interp->num_threads++;
 | 
			
		||||
    res = PyObject_Call(boot->func, boot->args, boot->keyw);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue