mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			376 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			376 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """
 | |
| From http://bugs.python.org/issue6717
 | |
| 
 | |
| A misbehaving trace hook can trigger a segfault by exceeding the recursion
 | |
| limit.
 | |
| """
 | |
| import sys
 | |
| 
 | |
| 
 | |
| def x():
 | |
|     pass
 | |
| 
 | |
| def g(*args):
 | |
|     if True: # change to True to crash interpreter
 | |
|         try:
 | |
|             x()
 | |
|         except:
 | |
|             pass
 | |
|     return g
 | |
| 
 | |
| def f():
 | |
|     print(sys.getrecursionlimit())
 | |
|     f()
 | |
| 
 | |
| sys.settrace(g)
 | |
| 
 | |
| f()
 | 
