mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-93044: No longer convert the database argument of sqlite3.connect() to bytes (GH-93046)
Just pass it to the factory as is.
This commit is contained in:
		
							parent
							
								
									b96e20c1d9
								
							
						
					
					
						commit
						14c0d33016
					
				
					 4 changed files with 19 additions and 7 deletions
				
			
		|  | @ -676,6 +676,19 @@ def test_open_uri(self): | |||
|             with managed_connect(f"file:{TESTFN}?mode=ro", uri=True) as cx: | ||||
|                 cx.execute(self._sql) | ||||
| 
 | ||||
|     def test_factory_database_arg(self): | ||||
|         def factory(database, *args, **kwargs): | ||||
|             nonlocal database_arg | ||||
|             database_arg = database | ||||
|             return sqlite.Connection(":memory:", *args, **kwargs) | ||||
| 
 | ||||
|         for database in (TESTFN, os.fsencode(TESTFN), | ||||
|                          FakePath(TESTFN), FakePath(os.fsencode(TESTFN))): | ||||
|             database_arg = None | ||||
|             with sqlite.connect(database, factory=factory): | ||||
|                 pass | ||||
|             self.assertEqual(database_arg, database) | ||||
| 
 | ||||
|     def test_database_keyword(self): | ||||
|         with sqlite.connect(database=":memory:") as cx: | ||||
|             self.assertEqual(type(cx), sqlite.Connection) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka