mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	[3.13] gh-118846: Fix free-threading test failures when run sequentially (GH-118864) (#118927)
The free-threaded build currently immortalizes some objects once the
first thread is started. This can lead to test failures depending on the
order in which tests are run. This PR addresses those failures by
suppressing immortalization or skipping the affected tests.
(cherry picked from commit b309c8ebff)
Co-authored-by: Sam Gross <colesbury@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									b3074f0d5e
								
							
						
					
					
						commit
						cceb758c78
					
				
					 8 changed files with 35 additions and 6 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| import weakref | ||||
| from test.support import gc_collect | ||||
| from test.support import import_helper | ||||
| from test.support import suppress_immortalization | ||||
| from test.support.script_helper import assert_python_ok | ||||
| 
 | ||||
| import sys | ||||
|  | @ -103,6 +104,7 @@ def f(): | |||
|         gc_collect() | ||||
|         self.assertEqual(f().__dict__["bar"], 4) | ||||
| 
 | ||||
|     @suppress_immortalization() | ||||
|     def test_clear_dict_in_ref_cycle(self): | ||||
|         destroyed = [] | ||||
|         m = ModuleType("foo") | ||||
|  | @ -118,6 +120,7 @@ def __del__(self): | |||
|         gc_collect() | ||||
|         self.assertEqual(destroyed, [1]) | ||||
| 
 | ||||
|     @suppress_immortalization() | ||||
|     def test_weakref(self): | ||||
|         m = ModuleType("foo") | ||||
|         wr = weakref.ref(m) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)