mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 287b84de93
			
		
	
	
		287b84de93
		
	
	
	
	
		
			
			The sqlit3.Connection object doesn't call its close() method when it's used as a context manager.
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			312 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			312 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import sqlite3
 | |
| 
 | |
| con = sqlite3.connect(":memory:")
 | |
| con.row_factory = sqlite3.Row
 | |
| 
 | |
| cur = con.cursor()
 | |
| cur.execute("select 'John' as name, 42 as age")
 | |
| for row in cur:
 | |
|     assert row[0] == row["name"]
 | |
|     assert row["name"] == row["nAmE"]
 | |
|     assert row[1] == row["age"]
 | |
|     assert row[1] == row["AgE"]
 | |
| 
 | |
| con.close()
 |