@@ -76,6 +76,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
76
76
};
77
77
78
78
char * database ;
79
+ PyObject * database_obj ;
79
80
int detect_types = 0 ;
80
81
PyObject * isolation_level = NULL ;
81
82
PyObject * factory = NULL ;
@@ -85,14 +86,16 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
85
86
double timeout = 5.0 ;
86
87
int rc ;
87
88
88
- if (!PyArg_ParseTupleAndKeywords (args , kwargs , "s |diOiOip" , kwlist ,
89
- & database , & timeout , & detect_types ,
89
+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "O& |diOiOip" , kwlist ,
90
+ PyUnicode_FSConverter , & database_obj , & timeout , & detect_types ,
90
91
& isolation_level , & check_same_thread ,
91
92
& factory , & cached_statements , & uri ))
92
93
{
93
94
return -1 ;
94
95
}
95
96
97
+ database = PyBytes_AsString (database_obj );
98
+
96
99
self -> initialized = 1 ;
97
100
98
101
self -> begin_statement = NULL ;
@@ -124,6 +127,8 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
124
127
#endif
125
128
Py_END_ALLOW_THREADS
126
129
130
+ Py_DECREF (database_obj );
131
+
127
132
if (rc != SQLITE_OK ) {
128
133
_pysqlite_seterror (self -> db , NULL );
129
134
return -1 ;
0 commit comments