From: Aaron J. Mackey Date: Fri, 13 Jun 2003 08:22:05 +0000 (-0400) Subject: Remove all magic in untie() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38193a09e3d9a4039dcc38f793ceb9482e7346d0;p=p5sagit%2Fp5-mst-13.2.git Remove all magic in untie() Subject: Re: untie from within FETCH/STORE not working under 5.8.0 (fwd) Message-ID: (plus a test case) p4raw-id: //depot/perl@19793 --- diff --git a/pp_sys.c b/pp_sys.c index c556597..77a547e 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -875,8 +875,8 @@ PP(pp_untie) (UV)SvREFCNT(obj) - 1 ) ; } } - sv_unmagic(sv, how) ; } + sv_unmagic(sv, how) ; RETPUSHYES; } diff --git a/t/op/tie.t b/t/op/tie.t index d643b78..dfbf44b 100755 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -326,3 +326,20 @@ print $f4{'foo'}[0],"\n"; EXPECT 2 3 +######## +# test untie() from within FETCH +package Foo; +sub TIESCALAR { my $pkg = shift; return bless [@_], $pkg; } +sub FETCH { + my $self = shift; + my ($obj, $field) = @$self; + untie $obj->{$field}; + $obj->{$field} = "Bar"; +} +package main; +tie $a->{foo}, "Foo", $a, "foo"; +$a->{foo}; # access once +# the hash element should not be tied anymore +print defined tied $a->{foo} ? "not ok" : "ok"; +EXPECT +ok