mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-43434: Move sqlite3.connect audit events to sqlite3.Connection.__init__ (GH-25818)
This commit is contained in:
parent
37e0c7850d
commit
c96cc089f6
5 changed files with 17 additions and 13 deletions
|
|
@ -86,6 +86,10 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sqlite3.connect", "O", database_obj) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
database = PyBytes_AsString(database_obj);
|
||||
|
||||
self->initialized = 1;
|
||||
|
|
@ -179,6 +183,10 @@ pysqlite_connection_init(pysqlite_Connection *self, PyObject *args,
|
|||
self->ProgrammingError = pysqlite_ProgrammingError;
|
||||
self->NotSupportedError = pysqlite_NotSupportedError;
|
||||
|
||||
if (PySys_Audit("sqlite3.connect/handle", "O", self) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,20 +91,11 @@ 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);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sqlite3.connect/handle", "O", self) < 0) {
|
||||
Py_DECREF(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue