bpo-37363: Add audit events for a range of modules (GH-14301)

(cherry picked from commit 60419a7e96577cf783b3b45bf3984f9fb0d7ddff)

Co-authored-by: Steve Dower <steve.dower@python.org>
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index c487ba9..9fe0dc9 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -85,6 +85,10 @@
         factory = (PyObject*)&pysqlite_ConnectionType;
     }
 
+    if (PySys_Audit("sqlite3.connect", "O", database) < 0) {
+        return NULL;
+    }
+
     result = PyObject_Call(factory, args, kwargs);
 
     return result;
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7a47180..c68bab8 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3758,6 +3758,10 @@
 os_listdir_impl(PyObject *module, path_t *path)
 /*[clinic end generated code: output=293045673fcd1a75 input=e3f58030f538295d]*/
 {
+    if (PySys_Audit("os.listdir", "O",
+                    path->object ? path->object : Py_None) < 0) {
+        return NULL;
+    }
 #if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR)
     return _listdir_windows_no_opendir(path, NULL);
 #else
@@ -13163,6 +13167,11 @@
 #endif
 #endif
 
+    if (PySys_Audit("os.scandir", "O",
+                    path->object ? path->object : Py_None) < 0) {
+        return NULL;
+    }
+
     iterator = PyObject_New(ScandirIterator, &ScandirIteratorType);
     if (!iterator)
         return NULL;