Chris Jerdonek <chris.jerdo...@gmail.com> added the comment:
I just want to flag one issue after rebasing my traceback PR onto what was merged. If task.cancel() is called like this-- task.cancel("POSSIBLY LONG CANCEL MESSAGE") There is the question of whether the passed message should be repeated each time the CancelledError is raised, or only show it in the innermost, originating exception. My preference is to do the latter because it is simpler, less verbose, and seems more correct from a Python perspective. But I wanted to flag this because the message won't be visible in the leading, outermost exception. There is a third alternative which is to mutate the exception each time (delete the message from the earlier exception and add it to the new exception). But that seems more fraught and what I'd consider surprising behavior. Lastly, to illustrate, here is the more verbose option (the one I think it **shouldn't** look like): Traceback (most recent call last): File "/.../cpython/test-cancel.py", line 4, in nested await asyncio.sleep(1) File "/.../cpython/Lib/asyncio/tasks.py", line 670, in sleep return await future asyncio.exceptions.CancelledError: POSSIBLY LONG CANCEL MESSAGE During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/.../cpython/test-cancel.py", line 11, in run await task asyncio.exceptions.CancelledError: POSSIBLY LONG CANCEL MESSAGE During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/.../cpython/test-cancel.py", line 15, in <module> loop.run_until_complete(run()) File "/.../cpython/Lib/asyncio/base_events.py", line 642, in run_until_complete return future.result() asyncio.exceptions.CancelledError: POSSIBLY LONG CANCEL MESSAGE ---------- versions: +Python 3.9 -Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31033> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com