GNU bug report logs - #50267
Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks

Previous Next

Package: guix;

Reported by: Ben Sturmfels <ben <at> sturm.com.au>

Date: Mon, 30 Aug 2021 13:02:01 UTC

Severity: normal

To reply to this bug, email your comments to 50267 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#50267; Package guix. (Mon, 30 Aug 2021 13:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Sturmfels <ben <at> sturm.com.au>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 30 Aug 2021 13:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ben Sturmfels <ben <at> sturm.com.au>
To: bug-guix <at> gnu.org
Subject: Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks
Date: Mon, 30 Aug 2021 22:45:19 +1000
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 2 years and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.