[New-bugs-announce] [issue37299] RuntimeWarning is NOT raised
YoSTEALTH
report at bugs.python.org
Sat Jun 15 22:22:30 EDT 2019
New submission from YoSTEALTH <ritesh at stealthcentral.com>:
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 error())"
async def no_error():
return await (false() or true()) # False
# Bad Problem
# `RuntimeWarning` is not raised for 'true'.
# Note
# The correct syntax is `return (await false()) or (await true()) as it should return `True`
# not `False`
async def test():
print(await no_error()) # False
print(await error()) # RuntimeWarning(...), False
if __name__ == '__main__':
run(test())
- Tested in Python 3.8.0b1
- Why does `error()` return `RuntimeWarning` but `no_error()` does not?
----------
components: asyncio
messages: 345723
nosy: YoSTEALTH, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: RuntimeWarning is NOT raised
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37299>
_______________________________________
More information about the New-bugs-announce
mailing list