Permalink
Browse files

Fix failing tests/aborts from wantarray fix

  • Loading branch information...
1 parent eaee27c commit d8a6cce76ae67a504b64e8f991ef9c6095d981c2 @ashb committed Aug 12, 2009
Showing with 7 additions and 3 deletions.
  1. +3 −1 TryCatch.xs
  2. +4 −2 lib/TryCatch.pm
View
@@ -98,7 +98,9 @@ STATIC OP* op_after_entertry(pTHX_ OP *op, void *user_data) {
// Sanity check the gimme, since we'll reset it in leavetry
if (cx->blk_gimme != G_VOID) {
- Perl_croak(aTHX_ "Try Catch Internal Error: ENTERTRY op did not have VOID context (it was %d)", cx->blk_gimme);
+ fprintf(stderr, "Try Catch Internal Error: ENTERTRY op did not have "
+ "VOID context (it was %d)\n", cx->blk_gimme);
+ abort();
}
cx->blk_gimme = get_sub_context();
return op;
View
@@ -128,12 +128,14 @@ sub injected_after_try {
}
sub injected_no_catch_code {
- return "};";
+ # This undef is to ensure that there is the eval{}; is called in void context
+ # i.e that its not the last op in a subroutine
+ return "};undef;";
}
sub injected_post_catch_code {
# We do it like this so that PROPGATE gets called, in case anyone is using it
- return 'else { $@ = $TryCatch::Error; die } }';
+ return 'else { $@ = $TryCatch::Error; die } };undef;';
}

0 comments on commit d8a6cce

Please sign in to comment.