mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	 287b84de93
			
		
	
	
		287b84de93
		
	
	
	
	
		
			
			The sqlit3.Connection object doesn't call its close() method when it's used as a context manager.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			431 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			431 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import sqlite3
 | |
| 
 | |
| con = sqlite3.connect(":memory:")
 | |
| cur = con.cursor()
 | |
| cur.executescript("""
 | |
|     create table person(
 | |
|         firstname,
 | |
|         lastname,
 | |
|         age
 | |
|     );
 | |
| 
 | |
|     create table book(
 | |
|         title,
 | |
|         author,
 | |
|         published
 | |
|     );
 | |
| 
 | |
|     insert into book(title, author, published)
 | |
|     values (
 | |
|         'Dirk Gently''s Holistic Detective Agency',
 | |
|         'Douglas Adams',
 | |
|         1987
 | |
|     );
 | |
|     """)
 | |
| con.close()
 |