mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 18:28:49 +00:00 
			
		
		
		
	 287b84de93
			
		
	
	
		287b84de93
		
	
	
	
	
		
			
			The sqlit3.Connection object doesn't call its close() method when it's used as a context manager.
		
			
				
	
	
		
			10 lines
		
	
	
	
		
			249 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
	
		
			249 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import sqlite3
 | |
| import datetime
 | |
| 
 | |
| con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
 | |
| cur = con.cursor()
 | |
| cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
 | |
| dt = cur.fetchone()[0]
 | |
| print(dt, type(dt))
 | |
| 
 | |
| con.close()
 |