-
Notifications
You must be signed in to change notification settings - Fork 13
Unretrieved task exceptions and Python 3.8 3.9
I don't know where else to comment on this, so a random wiki page will have to suffice.
Recently I noticed that keyboard interrupts (Ctrl+C) started to print tracebacks, even though the script is supposed to catch KeyboardInterrupt exceptions.
User Interrupt!
Task exception was never retrieved
future: <Task finished name='Task-110' coro=<process() done, defined at coub.py:1883> exception=KeyboardInterrupt()>
Traceback (most recent call last):
File "coub.py", line 1970, in <module>
main()
File "coub.py", line 1957, in main
attempt_process(coubs)
File "coub.py", line 1922, in attempt_process
asyncio.run(process(coubs), debug=False)
File "/usr/lib64/python3.8/asyncio/runners.py", line 46, in run
_cancel_all_tasks(loop)
File "/usr/lib64/python3.8/asyncio/runners.py", line 61, in _cancel_all_tasks
loop.run_until_complete(
File "/usr/lib64/python3.8/asyncio/base_events.py", line 603, in run_until_complete
self.run_forever()
File "/usr/lib64/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib64/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run()
File "/usr/lib64/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "coub.py", line 1891, in process
await asyncio.gather(*tasks)
File "/usr/lib64/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.8/asyncio/base_events.py", line 603, in run_until_complete
self.run_forever()
File "/usr/lib64/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib64/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run()
File "/usr/lib64/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "coub.py", line 1074, in process
self.check_existence()
File "coub.py", line 910, in check_existence
if old_file and not overwrite(old_file):
File "coub.py", line 1701, in overwrite
answer = input("#? ")
KeyboardInterrupt
This is such a typical traceback. Important to note is that User Interrupt!
is still being printed.
Initially I thought it might have something to do with this asyncio issue, but then it should've happened in the past as well.
After some more testing I realized that the issue only occurs when I use Python 3.8 or Python 3.9, while it works fine with Python 3.7.
I don't know enough about asyncio's underlying implementation to understand what change caused this new behavior (perhaps it has something to do with the changed base class for asyncio.CancelledError, but that's only a vague guess at best). Likewise I have no idea how to fix it.
So for now I can do nothing but acknowledge this problem.