summaryrefslogtreecommitdiff
path: root/ext/XS-APItest
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-05 06:13:27 +0000
committerZefram <zefram@fysh.org>2017-12-05 06:21:35 +0000
commit0740a29d60ebd4ff72090340b0140ec2210e90c7 (patch)
treedad4acffe5bffdd0e3b9ddfbb07140218c0bacac /ext/XS-APItest
parent28ef70489d76deb9024de42a0571162f323148c8 (diff)
downloadperl-0740a29d60ebd4ff72090340b0140ec2210e90c7.tar.gz
stop using &PL_sv_yes as no-op method
Method lookup yields a fake method for ->import or ->unimport if there's no actual method, for historical reasons so that "use" doesn't barf if there's no import method. This fake method used to be &PL_sv_yes being used as a magic placeholder, recognised specially by pp_entersub. But &PL_sv_yes is a string, which we'd expect to serve as a symbolic CV ref. Change method lookup to yield an actual CV with a body in this case, and remove the special case from pp_entersub. This fixes the remaining part of [perl #126042].
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r--ext/XS-APItest/APItest.xs10
-rw-r--r--ext/XS-APItest/t/call.t2
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 5ceb7fe939..891b7e71d4 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -2339,9 +2339,17 @@ CODE:
only current internal behavior, these tests can be changed in the
future if necessery */
PUSHMARK(SP);
- retcnt = call_sv(&PL_sv_yes, 0); /* does nothing */
+ retcnt = call_sv(&PL_sv_yes, G_EVAL);
SPAGAIN;
SP -= retcnt;
+ errsv = ERRSV;
+ errstr = SvPV(errsv, errlen);
+ if(memBEGINs(errstr, errlen, "Undefined subroutine &main::1 called at")) {
+ PUSHMARK(SP);
+ retcnt = call_sv((SV*)i_sub, 0); /* call again to increase counter */
+ SPAGAIN;
+ SP -= retcnt;
+ }
PUSHMARK(SP);
retcnt = call_sv(&PL_sv_no, G_EVAL);
SPAGAIN;
diff --git a/ext/XS-APItest/t/call.t b/ext/XS-APItest/t/call.t
index 355e49886e..8192b9bd36 100644
--- a/ext/XS-APItest/t/call.t
+++ b/ext/XS-APItest/t/call.t
@@ -33,7 +33,7 @@ sub i {
$call_sv_count++;
}
call_sv_C();
-is($call_sv_count, 6, "call_sv_C passes");
+is($call_sv_count, 7, "call_sv_C passes");
sub d {
die "its_dead_jim\n";