mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-131763: Replace the redundant check with assert in remove_tools (#131765)
This commit is contained in:
parent
52b5eb95b7
commit
151d1bfd1b
1 changed files with 3 additions and 2 deletions
|
@ -833,14 +833,15 @@ remove_tools(PyCodeObject * code, int offset, int event, int tools)
|
||||||
assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event));
|
assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event));
|
||||||
assert(opcode_has_event(_Py_GetBaseCodeUnit(code, offset).op.code));
|
assert(opcode_has_event(_Py_GetBaseCodeUnit(code, offset).op.code));
|
||||||
_PyCoMonitoringData *monitoring = code->_co_monitoring;
|
_PyCoMonitoringData *monitoring = code->_co_monitoring;
|
||||||
|
assert(monitoring);
|
||||||
bool should_de_instrument;
|
bool should_de_instrument;
|
||||||
if (monitoring && monitoring->tools) {
|
if (monitoring->tools) {
|
||||||
monitoring->tools[offset] &= ~tools;
|
monitoring->tools[offset] &= ~tools;
|
||||||
should_de_instrument = (monitoring->tools[offset] == 0);
|
should_de_instrument = (monitoring->tools[offset] == 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Single tool */
|
/* 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);
|
assert(_Py_popcount32(single_tool) <= 1);
|
||||||
should_de_instrument = ((single_tool & tools) == single_tool);
|
should_de_instrument = ((single_tool & tools) == single_tool);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue