You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect traceback when future's exception is raised multiple times #90082
There's a similar issue with concurrent.futures.Future, and really, anything that stores exceptions and later raises them can get in trouble if there's a way to get the exception raised multiple times. This is rarely noticed because usually the exception isn't raised more than once.
We need separate bpo issues for the other cases.
The fix is easy enough (separately store a traceback and raise using e.with_traceback(tb)) so I'm marking this as an easy issue.
hey Irit, Is this issue platform-dependent? I am on ubuntu 20.04, and running python 3.10. I am not getting the same error that you have mentioned below.
This is what I am getting.
###################################
hello ...
Traceback (most recent call last):
File "error.py", line 17, in mainprint(await fut)
TypeError: 42
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "error.py", line 21, in <module>
asyncio.run(main())
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in runreturn loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_completereturn future.result()
File "error.py", line 19, in main
traceback.print_exception(e)
TypeError: print_exception() missing 2 required positional arguments: 'value' and 'tb'
###########################################################
and if I replace traceback.print_exception method with the print method, It runs perfectly fine, printing
Activity
iritkatriel commentedon Nov 29, 2021
Background:
#29780 (comment)
#29780 (comment)
######################################################
Output (traceback accumulates a frame each time):
gvanrossum commentedon Nov 29, 2021
There's a similar issue with concurrent.futures.Future, and really, anything that stores exceptions and later raises them can get in trouble if there's a way to get the exception raised multiple times. This is rarely noticed because usually the exception isn't raised more than once.
We need separate bpo issues for the other cases.
The fix is easy enough (separately store a traceback and raise using e.with_traceback(tb)) so I'm marking this as an easy issue.
vishalpandeyvip commentedon Dec 1, 2021
hey Irit, Is this issue platform-dependent? I am on ubuntu 20.04, and running python 3.10. I am not getting the same error that you have mentioned below.
This is what I am getting.
###################################
###########################################################
and if I replace traceback.print_exception method with the print method, It runs perfectly fine, printing
hello ...
42
42
42
Can you please help me with this issue?
iritkatriel commentedon Dec 1, 2021
Vishal, your output shows you’re running 3.8, not 3.10.
traceback.print_exception() used to require 3 parameters, now it can make do with just one. See the docs for the details.
vishalpandeyvip commentedon Dec 1, 2021
thanks, It was my mistake, bug reproduced.
iritkatriel commentedon Mar 9, 2022
Closed bpo-46954 as a duplicate of this.
iritkatriel commentedon Mar 18, 2022
Closed bpo-42682 as duplicate of this.
kumaraditya303 commentedon Jul 12, 2022
Fixed by #30274