[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread Andrew Svetlov
Andrew Svetlov 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

[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread YoSTEALTH
YoSTEALTH added the comment: As far as i can tell "static analyzers" like flake8 and "type hints" like mypy does not detect this problem -- ___ Python tracker ___ ___

[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread Matthew Cowles
Matthew Cowles added the comment: I disagree with the decision not to fix this bug. If a RuntimeWarning is warranted when a temporary variable is used, it's warranted when the value is used directly, without a temporary variable. -- nosy: +mdcowles __

[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread Andrew Svetlov
Andrew Svetlov added the comment: The solution is called static analyzers and "type hints". Mypy detects the absence of "await" pretty well. In turn, CPython does the best in runtime mode for detecting not-awaited awaitables when possible. I think we should close the issue, it doesn't show a

[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread YoSTEALTH
YoSTEALTH added the comment: Yes, this was the previous conclusion. In a large code base, its hard to find such solution easily! There are many cases where `await` is not called and `RuntimeWarning` is not raised. Hard to narrow down the exact problem. Maybe there needs to be a better way t

[issue37299] RuntimeWarning is NOT raised

2019-06-17 Thread Paul Ganssle
Paul Ganssle added the comment: I think the reason for the difference here is in the `no_error` function you never actually create the coroutine `true()`, so there's nothing to warn about. One thing that's confusing things about this example is that the `false()` evaluates to True, because i

[issue37299] RuntimeWarning is NOT raised

2019-06-15 Thread YoSTEALTH
New submission from YoSTEALTH : from asyncio import run async def true(): return True async def false(): return False async def error(): a = false() b = true() return await (a or b) # Good Error # "RuntimeWarning: coroutine 'true' was never awaited print(await