unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Ben Sturmfels via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 50267@debbugs.gnu.org
Subject: bug#50267: Python PYTHONASYNCIODEBUG=1 not triggering debug tracebacks
Date: Mon, 30 Aug 2021 22:45:19 +1000	[thread overview]
Message-ID: <87v93n9jeg.fsf@sturm.com.au> (raw)

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




                 reply	other threads:[~2021-08-30 13:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v93n9jeg.fsf@sturm.com.au \
    --to=bug-guix@gnu.org \
    --cc=50267@debbugs.gnu.org \
    --cc=ben@sturm.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).