mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
bpo-43434: Move sqlite3.connect audit event to sqlite3.Connection.__init__ (GH-25818)
This commit is contained in:
parent
e60b1e150d
commit
ad73d1657c
3 changed files with 9 additions and 9 deletions
|
@ -0,0 +1,4 @@
|
|||
Creating a :class:`sqlite3.Connection` object now also produces
|
||||
a ``sqlite3.connect`` :ref:`auditing event <auditing>`.
|
||||
Previously this event was only produced by :func:`sqlite3.connect`
|
||||
calls. Patch by Erlend E. Aasland.
|
|
@ -96,6 +96,10 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sqlite3.connect", "O", database_obj) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
database = PyBytes_AsString(database_obj);
|
||||
|
||||
self->initialized = 1;
|
||||
|
|
|
@ -71,8 +71,6 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
|
|||
int uri = 0;
|
||||
double timeout = 5.0;
|
||||
|
||||
PyObject* result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|diOiOip", kwlist,
|
||||
&database, &timeout, &detect_types,
|
||||
&isolation_level, &check_same_thread,
|
||||
|
@ -85,13 +83,7 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
|
|||
factory = (PyObject*)&pysqlite_ConnectionType;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = PyObject_Call(factory, args, kwargs);
|
||||
|
||||
return result;
|
||||
return PyObject_Call(factory, args, kwargs);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(module_connect_doc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue