summaryrefslogtreecommitdiffstats
path: root/Python/instrumentation.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-01 23:44:07 (GMT)
committerGitHub <noreply@github.com>2023-07-01 23:44:07 (GMT)
commit18b1fdebe0cd5e601aa341227c13ec9d89bdf32c (patch)
tree701bc6f8ffcafff8eddc462192276a4d483f1a7b /Python/instrumentation.c
parent0530f4f64629ff97f3feb7524da0833b9535e8b6 (diff)
downloadcpython-18b1fdebe0cd5e601aa341227c13ec9d89bdf32c.zip
cpython-18b1fdebe0cd5e601aa341227c13ec9d89bdf32c.tar.gz
cpython-18b1fdebe0cd5e601aa341227c13ec9d89bdf32c.tar.bz2
gh-106320: Remove _PyInterpreterState_Get() alias (#106321)
Replace calls to the (removed) slow _PyInterpreterState_Get() with fast inlined _PyInterpreterState_GET() function.
Diffstat (limited to 'Python/instrumentation.c')
-rw-r--r--Python/instrumentation.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index 86d014e..3253a0e 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -1219,7 +1219,7 @@ _Py_call_instrumentation_instruction(PyThreadState *tstate, _PyInterpreterFrame*
PyObject *
_PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj)
{
- PyInterpreterState *is = _PyInterpreterState_Get();
+ PyInterpreterState *is = _PyInterpreterState_GET();
assert(0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS);
assert(0 <= event_id && event_id < PY_MONITORING_EVENTS);
PyObject *callback = is->monitoring_callables[tool_id][event_id];
@@ -1678,7 +1678,7 @@ int
_PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events)
{
assert(0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS);
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
assert(events < (1 << PY_MONITORING_UNGROUPED_EVENTS));
if (check_tool(interp, tool_id)) {
return -1;
@@ -1696,7 +1696,7 @@ int
_PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet events)
{
assert(0 <= tool_id && tool_id < PY_MONITORING_TOOL_IDS);
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
assert(events < (1 << PY_MONITORING_UNGROUPED_EVENTS));
if (check_tool(interp, tool_id)) {
return -1;
@@ -1758,7 +1758,7 @@ monitoring_use_tool_id_impl(PyObject *module, int tool_id, PyObject *name)
PyErr_SetString(PyExc_ValueError, "tool name must be a str");
return NULL;
}
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
if (interp->monitoring_tool_names[tool_id] != NULL) {
PyErr_Format(PyExc_ValueError, "tool %d is already in use", tool_id);
return NULL;
@@ -1782,7 +1782,7 @@ monitoring_free_tool_id_impl(PyObject *module, int tool_id)
if (check_valid_tool(tool_id)) {
return NULL;
}
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
Py_CLEAR(interp->monitoring_tool_names[tool_id]);
Py_RETURN_NONE;
}
@@ -1804,7 +1804,7 @@ monitoring_get_tool_impl(PyObject *module, int tool_id)
if (check_valid_tool(tool_id)) {
return NULL;
}
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
PyObject *name = interp->monitoring_tool_names[tool_id];
if (name == NULL) {
Py_RETURN_NONE;
@@ -1865,7 +1865,7 @@ monitoring_get_events_impl(PyObject *module, int tool_id)
if (check_valid_tool(tool_id)) {
return -1;
}
- _Py_Monitors *m = &_PyInterpreterState_Get()->monitors;
+ _Py_Monitors *m = &_PyInterpreterState_GET()->monitors;
_PyMonitoringEventSet event_set = get_events(m, tool_id);
return event_set;
}
@@ -1990,7 +1990,7 @@ monitoring_restart_events_impl(PyObject *module)
* last restart version > instrumented version for all code objects
* last restart version < current version
*/
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
interp->last_restart_version = interp->monitoring_version + 1;
interp->monitoring_version = interp->last_restart_version + 1;
if (instrument_all_executing_code_objects(interp)) {
@@ -2038,7 +2038,7 @@ static PyObject *
monitoring__all_events_impl(PyObject *module)
/*[clinic end generated code: output=6b7581e2dbb690f6 input=62ee9672c17b7f0e]*/
{
- PyInterpreterState *interp = _PyInterpreterState_Get();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
PyObject *res = PyDict_New();
if (res == NULL) {
return NULL;