Skip to content

Commit d5662de

Browse files
committed
Change ternary assignment to if
1 parent 4dbd83c commit d5662de

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/scorepy/cInstrumenter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ static const std::array<std::string, 8> WHAT_STRINGS = { "call", "exception"
6767
PyObject* CInstrumenter::operator()(PyFrameObject& frame, const char* what_string, PyObject* arg)
6868
{
6969
const auto it_what = std::find(WHAT_STRINGS.begin(), WHAT_STRINGS.end(), what_string);
70-
const int what =
71-
(it_what == WHAT_STRINGS.end()) ? -1 : std::distance(WHAT_STRINGS.begin(), it_what);
70+
int what = -1;
71+
if (it_what != WHAT_STRINGS.end())
72+
what = std::distance(WHAT_STRINGS.begin(), it_what);
7273
// To speed up further event processing install this class directly as the handler
7374
// But we might be inside a `sys.settrace` call where the user wanted to set another function
7475
// which would then be overwritten here. Hence use the CALL event which avoids the problem

0 commit comments

Comments
 (0)