-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Currently the below code generates the following graph, giving a complexity of 5:
def f():
try:
print(1)
except TypeA:
print(2)
except TypeB:
print(3)
else:
print(4)
finally:
if x:
print(5.1)
else:
print(5.2)
I don't think this models the try-else clause correctly. The above graph seems to indicate that the else sometimes runs instead of the main clause, which isn't correct. I believe this is the correct model:
This seems to correctly indicate that the else always runs directly after the main try clause, if it runs, and never in a line of execution that involves the exception handlers. This has 1 less complexity than the above graph. This yields one less complexity than the current interpretation.
Metadata
Metadata
Assignees
Labels
No labels