mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	gh-117783: Immortalize objects that use deferred reference counting (#118112)
Deferred reference counting is not fully implemented yet. As a temporary measure, we immortalize objects that would use deferred reference counting to avoid multi-threaded scaling bottlenecks. This is only performed in the free-threaded build once the first non-main thread is started. Additionally, some tests, including refleak tests, suppress this behavior.
This commit is contained in:
		
							parent
							
								
									8d4b756fd3
								
							
						
					
					
						commit
						7ccacb220d
					
				
					 13 changed files with 134 additions and 8 deletions
				
			
		|  | @ -7,7 +7,8 @@ | |||
| import time | ||||
| import trace | ||||
| 
 | ||||
| from test.support import os_helper, MS_WINDOWS, flush_std_streams | ||||
| from test.support import (os_helper, MS_WINDOWS, flush_std_streams, | ||||
|                           suppress_immortalization) | ||||
| 
 | ||||
| from .cmdline import _parse_args, Namespace | ||||
| from .findtests import findtests, split_test_packages, list_cases | ||||
|  | @ -526,7 +527,10 @@ def _run_tests(self, selected: TestTuple, tests: TestList | None) -> int: | |||
|             if self.num_workers: | ||||
|                 self._run_tests_mp(runtests, self.num_workers) | ||||
|             else: | ||||
|                 self.run_tests_sequentially(runtests) | ||||
|                 # gh-117783: don't immortalize deferred objects when tracking | ||||
|                 # refleaks. Only releveant for the free-threaded build. | ||||
|                 with suppress_immortalization(runtests.hunt_refleak): | ||||
|                     self.run_tests_sequentially(runtests) | ||||
| 
 | ||||
|             coverage = self.results.get_coverage_results() | ||||
|             self.display_result(runtests) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Gross
						Sam Gross