Re: bug: clear_eh patricide after catch

2003-08-14 Thread Leopold Toetsch
Michal Wallace [EMAIL PROTECTED] wrote:


 Here's a new test case for t/pmc/sub.t

 
 output_is('CODE', 'OUTPUT', set_eh - throw - clear_eh);
 print start\n
 newsub P20, .Exception_Handler, _handler
 set_eh P20
 new P30, .Exception
 throw P30
 print not reached\n
 end
 _handler:
 clear_eh
 print caught it\n
 end
 CODE
 start
 caught it
 OUTPUT
 #

[ panic ]

 I don't know if my test is right or not, but I'm
 expecting the exception handler to still be around
 after the exception is caught.

No, the exception object isn't around anymore in the handler, so you
don't Cclear_eh there.

This could of course be just my wrong implementation.

 I don't care if it goes away after the exception is
 caught, but I need a way to clear the exception
 handler after I get out of the try/except or
 try/finally block... Otherwise later exceptions
 will bring me backward in the code. :/

Can you insert Cclear_eh before you fall through to except/finally?

 Sincerely,

 Michal J Wallace

leo


bug: clear_eh patricide after catch

2003-08-14 Thread Michal Wallace


Here's a new test case for t/pmc/sub.t


output_is('CODE', 'OUTPUT', set_eh - throw - clear_eh);
print start\n
newsub P20, .Exception_Handler, _handler
set_eh P20
new P30, .Exception
throw P30
print not reached\n
end
_handler:
clear_eh
print caught it\n
end
CODE
start
caught it
OUTPUT
#


If I run this code from the perl test harness or 
from my python test suite, it actually kills 
perl/python, leaving nothing but the message Quit.

If I run the code directly from parrot, I get:


static
Parrot VM: PANIC: Tried to clear_eh a non Exception_Handler!
C file exceptions.c, line 143
Parrot file (unknown file), line 0

We highly suggest you notify the Parrot team if you have not been working on
Parrot.  Use bugs6.perl.org or send an e-mail to [EMAIL PROTECTED]
Include the entire text of this error message and the text of the script that
generated the error.  If you've made any modifications to Parrot, please
describe them as well.

Version : 0.0.10-devel
Configured  : Sun Aug 10 16:34:12 2003
Architecture: i386-linux
JIT Capable : Yes
Interp Flags: 0x40
Exceptions  : (missing from core)

Dumping Core...
Quit
###


I don't know if my test is right or not, but I'm
expecting the exception handler to still be around
after the exception is caught. 

I don't care if it goes away after the exception is 
caught, but I need a way to clear the exception 
handler after I get out of the try/except or 
try/finally block... Otherwise later exceptions
will bring me backward in the code. :/


Sincerely,
 
Michal J Wallace
Sabren Enterprises, Inc.
-
contact: [EMAIL PROTECTED]
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
--



Re: bug: clear_eh patricide after catch

2003-08-14 Thread Michal Wallace
On Mon, 11 Aug 2003, Leopold Toetsch wrote:

 No, the exception object isn't around anymore in the handler, so you
 don't Cclear_eh there.
 
 This could of course be just my wrong implementation.

No, it makes sense. You wouldn't want an exception in
the catch: block to trigger an infinite loop.

But if that's the way to go, there ought to be a note 
in the docs. (see patch below)

  I don't care if it goes away after the exception is
  caught, but I need a way to clear the exception
  handler after I get out of the try/except or
  try/finally block... Otherwise later exceptions
  will bring me backward in the code. :/
 
 Can you insert Cclear_eh before you fall through to except/finally?

Yep. That works perfectly. Thanks. :)

Sincerely,
 
Michal J Wallace
Sabren Enterprises, Inc.
-
contact: [EMAIL PROTECTED]
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
--

Index: core.ops
===
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.316
diff -c -r1.316 core.ops
*** core.ops8 Aug 2003 08:15:05 -   1.316
--- core.ops11 Aug 2003 23:30:55 -
***
*** 479,485 

  =item Bclear_eh()

! Clear out the most recently placed exception.

  =item Bthrow(in PMC)

--- 479,486 

  =item Bclear_eh()

! Clear out the most recently placed exception. This also
! happens automatically if an exception is thrown.

  =item Bthrow(in PMC)