-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
While looking at #87447 I've noticed that there are three places in cpython where assert(0) is used instead of Py_UNREACHABLE macro:
Lines 1539 to 1542 in 984894a
| /* We should always find either a FunctionBlock, ModuleBlock or ClassBlock | |
| and should never fall to this case | |
| */ | |
| assert(0); |
As the docs say:
Use this when you have a code path that cannot be reached by design.
For example, in thedefault:clause in aswitchstatement for which
all possible values are covered incasestatements. Use this in places
where you might be tempted to put anassert(0)orabort()call.
The intent with Py_UNREACHABLE is clearer and error message is nicer.
Linked PRs
zware
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error