mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			271 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			271 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import weakref
 | 
						|
 | 
						|
# http://python.org/sf/1377858
 | 
						|
 | 
						|
ref = None
 | 
						|
 | 
						|
def test_weakref_in_del():
 | 
						|
    class Target(object):
 | 
						|
        def __del__(self):
 | 
						|
            global ref
 | 
						|
            ref = weakref.ref(self)
 | 
						|
 | 
						|
    w = Target()
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    test_weakref_in_del()
 |