diff options
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r-- | Modules/_sqlite/connection.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 70e56aa..57eee2d 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -76,6 +76,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject }; char* database; + PyObject* database_obj; int detect_types = 0; PyObject* isolation_level = NULL; PyObject* factory = NULL; @@ -85,14 +86,16 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject double timeout = 5.0; int rc; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|diOiOip", kwlist, - &database, &timeout, &detect_types, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|diOiOip", kwlist, + PyUnicode_FSConverter, &database_obj, &timeout, &detect_types, &isolation_level, &check_same_thread, &factory, &cached_statements, &uri)) { return -1; } + database = PyBytes_AsString(database_obj); + self->initialized = 1; self->begin_statement = NULL; @@ -124,6 +127,8 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject #endif Py_END_ALLOW_THREADS + Py_DECREF(database_obj); + if (rc != SQLITE_OK) { _pysqlite_seterror(self->db, NULL); return -1; |