develooper Front page | perl.perl5.porters | Postings from May 2015

Re: FYI - PM posted about a horrible List::Util::first bug

Thread Previous | Thread Next
From:
perl
Date:
May 27, 2015 11:09
Subject:
Re: FYI - PM posted about a horrible List::Util::first bug
Message ID:
5565A5D9.1020603@profvince.com

> The arg passed to lc in the first() code block above is
>
>      SV = PV(0xa8ac28) at 0xaaa2d0
>        REFCNT = 1
>        FLAGS = (TEMP,POK,IsCOW,pPOK)
>        PV = 0xaa3c78 "ZXC"
>        CUR = 3
>        LEN = 0
>
> which satisfies the 'in-place' test of
>
>      if (   (  SvPADTMP(source)
> 	   || (  SvTEMP(source) && !SvSMAGICAL(source)
> 	      && SvREFCNT(source) == 1  )
> 	   )
> 	&& !SvREADONLY(source) && SvPOK(source)
> 	&& !DO_UTF8(source)) {
>
> So I don' think that condition is strong enough, and I'm not sure that
> that there is such a safe condition.
>

I think that this condition ought to be checked only when lc() is 
executed in (static) void context. Otherwise, its behaviour becomes 
quite unpredictable.


Vincent

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About