summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>2008-11-10 08:00:40 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-11-12 10:37:46 +0000
commit9711599ee3b2375539002b6ddc0873ec478916bb (patch)
tree0e22f4b859b7e8d870441377be736909ca5a8960 /mg.c
parent0c8767aeceb5f1c68d6318e2c8809e9913930642 (diff)
downloadperl-9711599ee3b2375539002b6ddc0873ec478916bb.tar.gz
Re: [perl #60360] [PATCH] local $SIG{FOO} = sub {...}; sets signal
Message-ID: <20081111000040.GB19329@tytlal.topaz.cx> p4raw-id: //depot/perl@34819
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mg.c b/mg.c
index 28eb9d28d7..22f8c9990d 100644
--- a/mg.c
+++ b/mg.c
@@ -463,15 +463,19 @@ Perl_mg_copy(pTHX_ SV *sv, SV *nsv, const char *key, I32 klen)
/*
=for apidoc mg_localize
-Copy some of the magic from an existing SV to new localized version of
-that SV. Container magic (eg %ENV, $1, tie) gets copied, value magic
-doesn't (eg taint, pos).
+Copy some of the magic from an existing SV to new localized version of that
+SV. Container magic (eg %ENV, $1, tie) gets copied, value magic doesn't (eg
+taint, pos).
+
+If empty is false then no set magic will be called on the new (empty) SV.
+This typically means that assignment will soon follow (e.g. 'local $x = $y'),
+and that will handle the magic.
=cut
*/
void
-Perl_mg_localize(pTHX_ SV *sv, SV *nsv)
+Perl_mg_localize(pTHX_ SV *sv, SV *nsv, I32 empty)
{
dVAR;
MAGIC *mg;
@@ -495,9 +499,11 @@ Perl_mg_localize(pTHX_ SV *sv, SV *nsv)
if (SvTYPE(nsv) >= SVt_PVMG && SvMAGIC(nsv)) {
SvFLAGS(nsv) |= SvMAGICAL(sv);
- PL_localizing = 1;
- SvSETMAGIC(nsv);
- PL_localizing = 0;
+ if (empty) {
+ PL_localizing = 1;
+ SvSETMAGIC(nsv);
+ PL_localizing = 0;
+ }
}
}