mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-99377: Add audit events for thread creation and clear (GH-99378)
This commit is contained in:
parent
01fa907aa8
commit
19c1462e8d
7 changed files with 117 additions and 7 deletions
|
@ -1145,6 +1145,11 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PySys_Audit("_thread.start_new_thread", "OOO",
|
||||
func, args, kwargs ? kwargs : Py_None) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (!_PyInterpreterState_HasFeature(interp, Py_RTFLAGS_THREADS)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
|
@ -1160,7 +1165,10 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
|
|||
boot->tstate = _PyThreadState_Prealloc(boot->interp);
|
||||
if (boot->tstate == NULL) {
|
||||
PyMem_Free(boot);
|
||||
return PyErr_NoMemory();
|
||||
if (!PyErr_Occurred()) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
boot->runtime = runtime;
|
||||
boot->func = Py_NewRef(func);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue