Andrew Svetlov <andrew.svet...@gmail.com> added the comment:
> If a RuntimeWarning is warranted when a temporary variable is used, it's > warranted when the value is used directly, without a temporary variable. No, it's not. If "1/0" is present in never executed code block Python don't raise an exception too. Warnings are not exceptional. open() raises ResoucesWarning for an unclosed file only if the code is actually running. If the code branch is not executed the Python runtime doesn't throw errors/warnings about its usage. I'm sorry, mypy doesn't detect this. Potentially could maybe, though. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37299> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com