Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #41726] [PATCH] make lua fail more gracefully with an exception handler

6 views
Skip to first unread message

Julian Fondren

unread,
Mar 7, 2007, 2:40:54 AM3/7/07
to bugs-bi...@rt.perl.org
# New Ticket Created by "Julian Fondren"
# Please include the string: [perl #41726]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41726 >


Currently, evaluating this:

function bad (n) return n * bad(n) end bad(2)

will cause lua to produce -- infinitely, and very
quickly -- ungraceful error messages. (It will do
this on any excess-recursion error -- I first saw
this behavior when I passed too-large a number to
a simple factorial function.)

The attached patch causes lua to generate .pir
files that push this exception handler before
evaluating any compiled-lua code:

root_exception_handler:
get_results '(0, 0)', $P0, $S0
$S0 = $P0[0]
print "Unhandled exception: "
print $S0
print "\n"
exit 1

I already sent this to Klaas-Jan Stol <parro...@gmail.com> ,
but when I didn't get a reply or see the change in svn after
a few days, I RTFM'd on contributing patches.

Cheers,
Julian

lua-exception.patch
0 new messages