mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	[3.13] gh-120678: pyrepl: Include globals from modules passed with -i (GH-120904) (#121916)
				
					
				
			(cherry picked from commit ac07451116)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
			
			
This commit is contained in:
		
							parent
							
								
									5a8e1373fe
								
							
						
					
					
						commit
						3d9692dbf8
					
				
					 6 changed files with 178 additions and 11 deletions
				
			
		|  | @ -1,3 +1,4 @@ | |||
| import os | ||||
| from code import InteractiveConsole | ||||
| from functools import partial | ||||
| from typing import Iterable | ||||
|  | @ -100,8 +101,18 @@ def handle_all_events( | |||
| ) | ||||
| 
 | ||||
| 
 | ||||
| def make_clean_env() -> dict[str, str]: | ||||
|     clean_env = os.environ.copy() | ||||
|     for k in clean_env.copy(): | ||||
|         if k.startswith("PYTHON"): | ||||
|             clean_env.pop(k) | ||||
|     clean_env.pop("FORCE_COLOR", None) | ||||
|     clean_env.pop("NO_COLOR", None) | ||||
|     return clean_env | ||||
| 
 | ||||
| 
 | ||||
| class FakeConsole(Console): | ||||
|     def __init__(self, events, encoding="utf-8"): | ||||
|     def __init__(self, events, encoding="utf-8") -> None: | ||||
|         self.events = iter(events) | ||||
|         self.encoding = encoding | ||||
|         self.screen = [] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)