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 }}
This repository has been archived by the owner on May 31, 2020. It is now read-only.
When an exception is raised from a try-catch suite enclosed in another try-catch suite and both suites are trying to catch exception of same type, the exception will be passed directly to the outer suite instead of propagate outwards from inner suite. e.g:
try:
try:
raise TypeError
except TypeError as e:
print("handled by first except")
try:
raise TypeError
except TypeError as e:
print("handled by second except")
except TypeError as e:
print("handled by outer except")
The correct output should be:
handled by first except
handled by second except
But voc produced the following output:
handled by outer except
Edit:
So I did some investigations on what is causing this behavior-- something to do with the Exception table generated by JVM. Below is the Exception table generated from the example code above:
Exception table:
from to target type
26 154 157 Class org/python/exceptions/TypeError
26 37 40 Class org/python/exceptions/TypeError
90 101 104 Class org/python/exceptions/TypeError
The outer exception handler is placed on top of the Exception table, so when TypeError is thrown, this entry is used by the JVM to resolve exception. The code execution will be redirected to offset 157 (the outer catch handler), bypassing the inner catch handler.
@freakboy3742, is this a bug in the JVM or can we somehow "sort" the Exception table by the label to in voc during transpilation?
The text was updated successfully, but these errors were encountered:
BPYap
added a commit
to BPYap/voc
that referenced
this issue
Aug 8, 2018
When an exception is raised from a try-catch suite enclosed in another try-catch suite and both suites are trying to catch exception of same type, the exception will be passed directly to the outer suite instead of propagate outwards from inner suite. e.g:
The correct output should be:
But voc produced the following output:
Edit:
So I did some investigations on what is causing this behavior-- something to do with the Exception table generated by JVM. Below is the Exception table generated from the example code above:
The outer exception handler is placed on top of the Exception table, so when TypeError is thrown, this entry is used by the JVM to resolve exception. The code execution will be redirected to offset 157 (the outer catch handler), bypassing the inner catch handler.
@freakboy3742, is this a bug in the JVM or can we somehow "sort" the Exception table by the label
to
in voc during transpilation?The text was updated successfully, but these errors were encountered: