mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	[3.13] gh-119469: Fix _pyrepl reference leaks (GH-119470) (#119471)
(cherry picked from commit 6e012ced6c)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
			
			
This commit is contained in:
		
							parent
							
								
									251ef2e36f
								
							
						
					
					
						commit
						8fd8cc564b
					
				
					 2 changed files with 30 additions and 12 deletions
				
			
		|  | @ -27,9 +27,11 @@ def bar(self): | |||
|         a | ||||
|         """) | ||||
|         console = InteractiveColoredConsole(namespace, filename="<stdin>") | ||||
|         f = io.StringIO() | ||||
|         with ( | ||||
|             patch.object(InteractiveColoredConsole, "showsyntaxerror") as showsyntaxerror, | ||||
|             patch.object(InteractiveColoredConsole, "runsource", wraps=console.runsource) as runsource, | ||||
|             contextlib.redirect_stdout(f), | ||||
|         ): | ||||
|             more = console.push(code, filename="<stdin>", _symbol="single")  # type: ignore[call-arg] | ||||
|         self.assertFalse(more) | ||||
|  | @ -71,7 +73,9 @@ def test_runsource_compiles_and_runs_code(self): | |||
|     def test_runsource_returns_false_for_successful_compilation(self): | ||||
|         console = InteractiveColoredConsole() | ||||
|         source = "print('Hello, world!')" | ||||
|         result = console.runsource(source) | ||||
|         f = io.StringIO() | ||||
|         with contextlib.redirect_stdout(f): | ||||
|             result = console.runsource(source) | ||||
|         self.assertFalse(result) | ||||
| 
 | ||||
|     @force_not_colorized | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)