Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix method calls on P5 exception objects
When we started supporting stringification of Perl 5 objects,
S01-perl-5-integration/exception_handling.t started failing.

The reason is that the ERRSV pointer never changes. Instead, the SV it
points to gets overwritten with the exception object. As a result, we
cannot just wrap the ERRSV pointer in a Perl5Object, since this only
works until Perl 5 resets $@. From that point on all method calls will
fail.

Fixed by creating a copy of the SV before converting it to a Perl 6
scalar.
  • Loading branch information
niner committed Jul 4, 2015
1 parent ae9f31b commit c8e0bc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p5helper.c
Expand Up @@ -214,7 +214,7 @@ SV *p5_eval_pv(PerlInterpreter *my_perl, const char* p, I32 croak_on_error) {
}

SV *p5_err_sv(PerlInterpreter *my_perl) {
return ERRSV;
return sv_mortalcopy(ERRSV);
}

AV *p5_call_package_method(PerlInterpreter *my_perl, char *package, char *name, int len, SV *args[]) {
Expand Down

0 comments on commit c8e0bc5

Please sign in to comment.