[New-bugs-announce] [issue36221] Setting PYTHONASYNCIODEBUG breaks warnings
Denis S. Otkidach
report at bugs.python.org
Thu Mar 7 01:58:38 EST 2019
New submission from Denis S. Otkidach <denis.otkidach at gmail.com>:
Test script:
-->8--
import asyncio
@asyncio.coroutine
def test():
with (yield from asyncio.Lock()):
pass
asyncio.run(test())
-->8--
Correct behavior without flag (warning is reported and points to correct line of code):
---
$ python test.py
test.py:5: DeprecationWarning: 'with (yield from lock)' is deprecated use 'async with lock' instead
with (yield from asyncio.Lock()):
---
Setting PYTHONASYNCIODEBUG flag disables warning:
---
$ PYTHONASYNCIODEBUG=1 python test.py
$
---
Warning is back explicitly turned on, but points to incorrect position in stack:
---
$ PYTHONASYNCIODEBUG=1 python -Wall test.py
lib/python3.8/asyncio/coroutines.py:58: DeprecationWarning: 'with (yield from lock)' is deprecated use 'async with lock' instead
return self.gen.send(None)
---
Another way to enable debugging doesn't disable warnings, but break its location too:
---
$ python -Xdev test.py
lib/python3.8/asyncio/coroutines.py:58: DeprecationWarning: 'with (yield from lock)' is deprecated use 'async with lock' instead
return self.gen.send(None)
---
----------
components: asyncio
messages: 337366
nosy: asvetlov, ods, yselivanov
priority: normal
severity: normal
status: open
title: Setting PYTHONASYNCIODEBUG breaks warnings
type: behavior
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36221>
_______________________________________
More information about the New-bugs-announce
mailing list