Skip to content

Commit 6409f2d

Browse files
fix instrumentation
1 parent 9a21df7 commit 6409f2d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Python/instrumentation.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ instrument_per_instruction(PyCodeObject *code, _Py_CODEUNIT *bytecode,
827827
static void
828828
remove_tools(PyCodeObject * code, int offset, int event, int tools)
829829
{
830-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
830+
ASSERT_WORLD_STOPPED();
831831
assert(event != PY_MONITORING_EVENT_LINE);
832832
assert(event != PY_MONITORING_EVENT_INSTRUCTION);
833833
assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event));
@@ -863,7 +863,7 @@ tools_is_subset_for_event(PyCodeObject * code, int event, int tools)
863863
static void
864864
remove_line_tools(PyCodeObject * code, int offset, int tools)
865865
{
866-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
866+
ASSERT_WORLD_STOPPED();
867867

868868
_PyCoMonitoringData *monitoring = code->_co_monitoring;
869869
assert(monitoring);
@@ -888,7 +888,7 @@ remove_line_tools(PyCodeObject * code, int offset, int tools)
888888
static void
889889
add_tools(PyCodeObject * code, int offset, int event, int tools)
890890
{
891-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
891+
ASSERT_WORLD_STOPPED();
892892
assert(event != PY_MONITORING_EVENT_LINE);
893893
assert(event != PY_MONITORING_EVENT_INSTRUCTION);
894894
assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event));
@@ -909,7 +909,7 @@ add_tools(PyCodeObject * code, int offset, int event, int tools)
909909
static void
910910
add_line_tools(PyCodeObject * code, int offset, int tools)
911911
{
912-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
912+
ASSERT_WORLD_STOPPED();
913913

914914
assert(tools_is_subset_for_event(code, PY_MONITORING_EVENT_LINE, tools));
915915
assert(code->_co_monitoring);
@@ -927,7 +927,7 @@ add_line_tools(PyCodeObject * code, int offset, int tools)
927927
static void
928928
add_per_instruction_tools(PyCodeObject * code, int offset, int tools)
929929
{
930-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
930+
ASSERT_WORLD_STOPPED();
931931

932932
assert(tools_is_subset_for_event(code, PY_MONITORING_EVENT_INSTRUCTION, tools));
933933
assert(code->_co_monitoring);
@@ -1190,9 +1190,9 @@ call_instrumentation_vector(
11901190
break;
11911191
}
11921192
else {
1193-
LOCK_CODE(code);
1193+
_PyEval_StopTheWorld(tstate->interp);
11941194
remove_tools(code, offset, event, 1 << tool);
1195-
UNLOCK_CODE();
1195+
_PyEval_StartTheWorld(tstate->interp);
11961196
}
11971197
}
11981198
}
@@ -1773,7 +1773,7 @@ update_instrumentation_data(PyCodeObject *code, PyInterpreterState *interp)
17731773
static int
17741774
force_instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
17751775
{
1776-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
1776+
ASSERT_WORLD_STOPPED();
17771777

17781778
#ifdef _Py_TIER2
17791779
if (code->co_executors != NULL) {
@@ -1904,7 +1904,7 @@ force_instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
19041904
static int
19051905
instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
19061906
{
1907-
ASSERT_WORLD_STOPPED_OR_LOCKED(code);
1907+
ASSERT_WORLD_STOPPED();
19081908

19091909
if (is_version_up_to_date(code, interp)) {
19101910
assert(
@@ -1921,9 +1921,9 @@ int
19211921
_Py_Instrument(PyCodeObject *code, PyInterpreterState *interp)
19221922
{
19231923
int res;
1924-
LOCK_CODE(code);
1924+
_PyEval_StopTheWorld(interp);
19251925
res = instrument_lock_held(code, interp);
1926-
UNLOCK_CODE();
1926+
_PyEval_StartTheWorld(interp);
19271927
return res;
19281928
}
19291929

0 commit comments

Comments
 (0)