develooper Front page | perl.perl5.porters | Postings from July 2016

Re: [perl #128588] Tied hash magic ignored in references the firsttime 'round

Thread Previous | Thread Next
July 10, 2016 02:27
Re: [perl #128588] Tied hash magic ignored in references the firsttime 'round
Message ID:
Father Chrysostomos via RT wrote:
>Also, the patch as it is does not account for FETCH undefining the
>reference.  I think it will crash in that case.

Yes.  I think it should do the dereference (SvRV(sv)) exactly once, and
hold a reference during SvGETMAGIC().  Bummer that that requires diddling
refcounts, in an operation that didn't require it before.  However, it
can be avoided in most cases.  It would suffice to create a mortal ref
only in the cases where the flags say there is magic.  Possibly also
only in the cases where the referent is an unblessed scalar, though
using those conditions would pretty much require the magic handling to
be moved down into sv_reftype().

I wonder about other callers to sv_ref() and especially sv_reftype().
Many presumably have already handled magic, but maybe some ought to have
it added.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About