GNU bug report logs -
#50267
Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi Folks,
When I run a Python program with PYTHONASYNCIODEBUG=1, I'm not seeing
the debugging traceback I expect.
Here's the test program, asynctest.py containing an async bug:
import asyncio
async def test():
print("never scheduled")
async def main():
# Should be "async test()"
test()
asyncio.run(main())
Run this with `python3 asynctest.py` I get as expected:
asynctest.py:7: RuntimeWarning: coroutine 'test' was never awaited
test()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Running with `PYTHONASYNCIODEBUG=1 python3 asynctest.py`, I don't see
any additional debugging output:
asynctest.py:7: RuntimeWarning: coroutine 'test' was never awaited
test()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
I tried running it inside a `guix environment --container` just in case
it was my setup, but no difference.
But on Ubuntu 20.04 (also Python 3.8), I get the expected debugging output:
asynctest.py:7: RuntimeWarning: coroutine 'test' was never awaited
Coroutine created at (most recent call last)
File "asynctest.py", line 9, in <module>
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
self.run_forever()
File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1851, in _run_once
handle._run()
File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "t.py", line 7, in main
test()
test()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
See also:
https://docs.python.org/3.8/library/asyncio-dev.html#asyncio-debug-mode
Regards,
Ben
This bug report was last modified 3 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.