summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-29 13:14:40 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-29 13:14:40 -0700
commit2f14e398cab171c93c6228512985ee84aa35be83 (patch)
tree9f2839f0fa19e8be5a2130142163f7a632d070f5
parent50dc2bd3d35d30eddfffb841752c40e125e49edc (diff)
downloadperl-2f14e398cab171c93c6228512985ee84aa35be83.tar.gz
Make undef &foo remove call checkers
The fact that the call checker is stored in magic is an implementation detail. cv_undef does not free magic, so the call checker lives on. If we were to move the parameter prototype into magic internally, we would not want undef to stop clearing it. To me, the current situa- tion with call checkers is similar.
-rw-r--r--ext/XS-APItest/t/call_checker.t11
-rw-r--r--pad.c1
2 files changed, 11 insertions, 1 deletions
diff --git a/ext/XS-APItest/t/call_checker.t b/ext/XS-APItest/t/call_checker.t
index 429cea6b9b..b01323a75e 100644
--- a/ext/XS-APItest/t/call_checker.t
+++ b/ext/XS-APItest/t/call_checker.t
@@ -1,6 +1,6 @@
use warnings;
use strict;
-use Test::More tests => 67;
+use Test::More tests => 70;
use XS::APItest;
@@ -169,4 +169,13 @@ is $@, "";
is_deeply $foo_got, [ qw(a b), qw(a b c) ];
is $foo_ret, "z";
+cv_set_call_checker_lists(\&foo);
+undef &foo;
+$foo_got = undef;
+eval 'sub foo($@) { $foo_got = [ @_ ]; return "z"; }
+ $foo_ret = foo(@b, @c);';
+is $@, "";
+is_deeply $foo_got, [ 2, qw(a b c) ], 'undef clears call checkers';
+is $foo_ret, "z";
+
1;
diff --git a/pad.c b/pad.c
index 352c5f9ef0..71d5296b46 100644
--- a/pad.c
+++ b/pad.c
@@ -375,6 +375,7 @@ Perl_cv_undef(pTHX_ CV *cv)
else if (slabbed) Perl_warn(aTHX_ "Slab leaked from cv %p", cv);
#endif
SvPOK_off(MUTABLE_SV(cv)); /* forget prototype */
+ sv_unmagic((SV *)cv, PERL_MAGIC_checkcall);
CvGV_set(cv, NULL);
/* This statement and the subsequence if block was pad_undef(). */