mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
fix: assert
de-optimization bug
This commit is contained in:
parent
cfc2214bfb
commit
20a94b806a
4 changed files with 8 additions and 5 deletions
|
@ -3,15 +3,16 @@ unsound = import "unsound"
|
|||
# TODO: exception: Exception
|
||||
unsound.pyexec("""
|
||||
def try_(p, exc=lambda _: None, els=lambda: None, fin=lambda: None):
|
||||
__result = None
|
||||
try:
|
||||
res = p()
|
||||
__result = p()
|
||||
except Exception as e:
|
||||
res = exc(e)
|
||||
__result = exc(e)
|
||||
else:
|
||||
els()
|
||||
finally:
|
||||
fin()
|
||||
return res
|
||||
return __result
|
||||
""")
|
||||
.try! = unsound.pyeval("try_")
|
||||
assert .try! in |T, U|(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue