mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	gh-106236: Replace assert with raise RuntimeError in threading.py (#106237)
				
					
				
			Replace `assert` with `raise ` in `threading.py` so that -OO does not alter _DummyThread behavior.
This commit is contained in:
		
							parent
							
								
									dd1884dc5d
								
							
						
					
					
						commit
						e4b88c1e4a
					
				
					 3 changed files with 14 additions and 3 deletions
				
			
		|  | @ -251,6 +251,14 @@ def f(mutex): | |||
|         #Issue 29376 | ||||
|         self.assertTrue(threading._active[tid].is_alive()) | ||||
|         self.assertRegex(repr(threading._active[tid]), '_DummyThread') | ||||
| 
 | ||||
|         # Issue gh-106236: | ||||
|         with self.assertRaises(RuntimeError): | ||||
|             threading._active[tid].join() | ||||
|         threading._active[tid]._started.clear() | ||||
|         with self.assertRaises(RuntimeError): | ||||
|             threading._active[tid].is_alive() | ||||
| 
 | ||||
|         del threading._active[tid] | ||||
| 
 | ||||
|     # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nikita Sobolev
						Nikita Sobolev