IronLanguages / IronLanguages/ironpython3
Cascading exceptions not properly reported
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
Consider the following sample code:
try:
assert False
except Exception as ex:
0/0
CPython reports both exceptions:
Traceback (most recent call last):
File ".\ex_cascade.py", line 2, in <module>
assert False
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\ex_cascade.py", line 5, in <module>
0/0
ZeroDivisionError: division by zero
IronPython, however, fails to report the original exception:
Traceback (most recent call last):
File ".\ex_cascade.py", line 5, in <module>
ZeroDivisionError: Attempted to divide by zero.
Note that IronPython has already code to properly display chained exceptions, however the exceptions from the example above are not being chained. Perhaps this is related to IronLanguages/ironpython2#493.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the exception-reporting code in Src/IronPython/Runtime/PythonContext.cs around the linked chained-exception logic, then trace how exceptions raised while handling another exception are propagated. Compare the sample's IronPython and CPython output, and review IronLanguages/ironpython2#493 for related context. Done means the original and subsequent exceptions are both reported with the expected chaining wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100