Skip to content

Commit c12fc81

Browse files
authored
Merge branch 'main' into none-constant-hash
2 parents 0c08cac + 5fdd49d commit c12fc81

File tree

6 files changed

+5
-50
lines changed

6 files changed

+5
-50
lines changed

Doc/c-api/init.rst

-13
Original file line numberDiff line numberDiff line change
@@ -1239,25 +1239,12 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
12391239
The global interpreter lock need not be held, but may be held if it is
12401240
necessary to serialize calls to this function.
12411241
1242-
.. audit-event:: cpython.PyThreadState_New id c.PyThreadState_New
1243-
1244-
Raise an auditing event ``cpython.PyThreadState_New`` with Python's thread
1245-
id as the argument. The event will be raised from the thread creating the new
1246-
``PyThreadState``, which may not be the new thread.
1247-
12481242
12491243
.. c:function:: void PyThreadState_Clear(PyThreadState *tstate)
12501244
12511245
Reset all information in a thread state object. The global interpreter lock
12521246
must be held.
12531247
1254-
.. audit-event:: cpython.PyThreadState_Clear id c.PyThreadState_Clear
1255-
1256-
Raise an auditing event ``cpython.PyThreadState_Clear`` with Python's
1257-
thread id as the argument. The event may be raised from a different thread
1258-
than the one being cleared. Exceptions raised from a hook will be treated
1259-
as unraisable and will not abort the operation.
1260-
12611248
.. versionchanged:: 3.9
12621249
This function now calls the :c:member:`PyThreadState.on_delete` callback.
12631250
Previously, that happened in :c:func:`PyThreadState_Delete`.

Lib/test/test_audit.py

-8
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,11 @@ def test_threading(self):
197197
actual = [(ev[0], ev[2]) for ev in events]
198198
expected = [
199199
("_thread.start_new_thread", "(<test_func>, (), None)"),
200-
("cpython.PyThreadState_New", "(2,)"),
201200
("test.test_func", "()"),
202-
("cpython.PyThreadState_Clear", "(2,)"),
203201
]
204202

205203
self.assertEqual(actual, expected)
206204

207-
def test_threading_abort(self):
208-
# Ensures that aborting PyThreadState_New raises the correct exception
209-
returncode, events, stderr = self.run_python("test_threading_abort")
210-
if returncode:
211-
self.fail(stderr)
212-
213205

214206
def test_wmi_exec_query(self):
215207
import_helper.import_module("_wmi")

Lib/test/test_venv.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ def test_zippath_from_non_installed_posix(self):
594594
# For python built with shared enabled. We need to set
595595
# LD_LIBRARY_PATH so the non-installed python can find and link
596596
# libpython.so
597-
ld_library_path = os.path.abspath(os.path.dirname(sys.executable))
597+
ld_library_path = sysconfig.get_config_var("LIBDIR")
598+
if not ld_library_path or sysconfig.is_python_build():
599+
ld_library_path = os.path.abspath(os.path.dirname(sys.executable))
598600
if sys.platform == 'darwin':
599601
ld_library_path_env = "DYLD_LIBRARY_PATH"
600602
else:

Objects/descrobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class property "propertyobject *" "&PyProperty_Type"
1717
// see pycore_object.h
1818
#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
1919
#include <emscripten.h>
20-
EM_JS(PyObject*, descr_set_trampoline_call, (setter set, PyObject *obj, PyObject *value, void *closure), {
20+
EM_JS(int, descr_set_trampoline_call, (setter set, PyObject *obj, PyObject *value, void *closure), {
2121
return wasmTable.get(set)(obj, value, closure);
2222
});
2323

Objects/frameobject.c

-9
Original file line numberDiff line numberDiff line change
@@ -849,15 +849,6 @@ static PyGetSetDef frame_getsetlist[] = {
849849
{0}
850850
};
851851

852-
/* Stack frames are allocated and deallocated at a considerable rate.
853-
In an attempt to improve the speed of function calls, we maintain
854-
a separate free list of stack frames (just like floats are
855-
allocated in a special way -- see floatobject.c). When a stack
856-
frame is on the free list, only the following members have a meaning:
857-
ob_type == &Frametype
858-
f_back next item on free list, or NULL
859-
*/
860-
861852
static void
862853
frame_dealloc(PyFrameObject *f)
863854
{

Python/pystate.c

+1-18
Original file line numberDiff line numberDiff line change
@@ -875,27 +875,14 @@ PyThreadState_New(PyInterpreterState *interp)
875875
PyThreadState *tstate = new_threadstate(interp);
876876
if (tstate) {
877877
_PyThreadState_SetCurrent(tstate);
878-
if (PySys_Audit("cpython.PyThreadState_New", "K", tstate->id) < 0) {
879-
PyThreadState_Clear(tstate);
880-
_PyThreadState_DeleteCurrent(tstate);
881-
return NULL;
882-
}
883878
}
884879
return tstate;
885880
}
886881

887882
PyThreadState *
888883
_PyThreadState_Prealloc(PyInterpreterState *interp)
889884
{
890-
PyThreadState *tstate = new_threadstate(interp);
891-
if (tstate) {
892-
if (PySys_Audit("cpython.PyThreadState_New", "K", tstate->id) < 0) {
893-
PyThreadState_Clear(tstate);
894-
_PyThreadState_Delete(tstate, 0);
895-
return NULL;
896-
}
897-
}
898-
return tstate;
885+
return new_threadstate(interp);
899886
}
900887

901888
// We keep this around for (accidental) stable ABI compatibility.
@@ -1043,10 +1030,6 @@ _PyInterpreterState_ClearModules(PyInterpreterState *interp)
10431030
void
10441031
PyThreadState_Clear(PyThreadState *tstate)
10451032
{
1046-
if (PySys_Audit("cpython.PyThreadState_Clear", "K", tstate->id) < 0) {
1047-
PyErr_WriteUnraisable(NULL);
1048-
}
1049-
10501033
int verbose = _PyInterpreterState_GetConfig(tstate->interp)->verbose;
10511034

10521035
if (verbose && tstate->cframe->current_frame != NULL) {

0 commit comments

Comments
 (0)