unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50267: Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks
@ 2021-08-30 12:45 Ben Sturmfels via Bug reports for GNU Guix
  0 siblings, 0 replies; only message in thread
From: Ben Sturmfels via Bug reports for GNU Guix @ 2021-08-30 12:45 UTC (permalink / raw)
  To: 50267

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-30 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 12:45 bug#50267: Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks Ben Sturmfels via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).