Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks

  • Open
  • quality assurance status badge
Details
One participant
  • Ben Sturmfels
Owner
unassigned
Submitted by
Ben Sturmfels
Severity
normal
B
B
Ben Sturmfels wrote on 30 Aug 2021 14:45
(address . bug-guix@gnu.org)
87v93n9jeg.fsf@sturm.com.au
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:

Regards,
Ben
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 50267@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 50267
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch