assert isinstance(flag, bool) reads like a check. Under python -O it is not there at all, and nothing at the call site says so. The usual advice is to stop writing safety checks as asserts. There is a better answer: let the module refuse to be imported in the mode where its checks evaporate. if not __debug__: raise RuntimeError("this module's... Weiterlesen
Intelligence View
⚡ tsecurity.de Intelligence
My safety check was an assert. Five lines made the module refuse to load without it.
assert isinstance(flag, bool) reads like a check. Under python -O it is not there at all, and nothing at the call site says so. The usual advice is to stop writing safety checks as asserts. There is a better answer: let the module refuse…
Reagiere als Erste:r — dein Feedback zählt!