mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	gh-115482: Assume the Main Interpreter is Always Running "main" (gh-115484)
This is a temporary fix to unblock embedders that do not call Py_Main(). _PyInterpreterState_IsRunningMain() will always return true for the main interpreter, even in corner cases where it technically should not. The (future) full solution will do the right thing in those corner cases.
This commit is contained in:
		
							parent
							
								
									3e7b7df5cb
								
							
						
					
					
						commit
						468430189d
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -1044,7 +1044,14 @@ _PyInterpreterState_SetNotRunningMain(PyInterpreterState *interp) | |||
| int | ||||
| _PyInterpreterState_IsRunningMain(PyInterpreterState *interp) | ||||
| { | ||||
|     return (interp->threads.main != NULL); | ||||
|     if (interp->threads.main != NULL) { | ||||
|         return 1; | ||||
|     } | ||||
|     // For now, we assume the main interpreter is always running.
 | ||||
|     if (_Py_IsMainInterpreter(interp)) { | ||||
|         return 1; | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| int | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Eric Snow
						Eric Snow