aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
authorSergey Muraviov <smurav@mail.ru>2025-03-27 01:36:04 +0300
committerGitHub <noreply@github.com>2025-03-26 18:36:04 -0400
commit151d1bfd1bb7ca9a36bb0f2bd6df53d64a1ba2f2 (patch)
tree5b9410d9a11650b20703c53ba748d54300bfd5af /Python
parent52b5eb95b770fa00ebbd449ba40cab4a0e7c7df7 (diff)
downloadcpython-151d1bfd1bb7ca9a36bb0f2bd6df53d64a1ba2f2.tar.gz
cpython-151d1bfd1bb7ca9a36bb0f2bd6df53d64a1ba2f2.zip
gh-131763: Replace the redundant check with assert in remove_tools (#131765)
Diffstat (limited to 'Python')
-rw-r--r--Python/instrumentation.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index bcf7267d23b..979047cc6fe 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -833,14 +833,15 @@ remove_tools(PyCodeObject * code, int offset, int event, int tools)
assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event));
assert(opcode_has_event(_Py_GetBaseCodeUnit(code, offset).op.code));
_PyCoMonitoringData *monitoring = code->_co_monitoring;
+ assert(monitoring);
bool should_de_instrument;
- if (monitoring && monitoring->tools) {
+ if (monitoring->tools) {
monitoring->tools[offset] &= ~tools;
should_de_instrument = (monitoring->tools[offset] == 0);
}
else {
/* Single tool */
- uint8_t single_tool = code->_co_monitoring->active_monitors.tools[event];
+ uint8_t single_tool = monitoring->active_monitors.tools[event];
assert(_Py_popcount32(single_tool) <= 1);
should_de_instrument = ((single_tool & tools) == single_tool);
}