develooper Front page | perl.perl5.porters | Postings from April 2008

Re: [perl #53244] perl-5.10.0-33733 assertion with JSON::XS-2.2

Thread Previous | Thread Next
From:
Sam Vilain
Date:
April 28, 2008 19:31
Subject:
Re: [perl #53244] perl-5.10.0-33733 assertion with JSON::XS-2.2
Message ID:
4816888D.2090902@vilain.net
Marc Lehmann wrote:
> On Fri, Apr 25, 2008 at 05:20:48PM -0700, Jan Dubois <jand@activestate.com> wrote:
>> I don't think a CPAN module should _ever_ check the private flags. They
>> are for core Perl usage only.  At least that's how it used to be.  Isn't
>> checking SvPOK() before accessing SvCUR() doing the right thing for you?
> 
> upgrading to a PV was always doing the right thing for me. The code in
> question seems to dot he right thing, too, in all perl releases I have
> tried, including 5.10.
> 
> I also don't really think that SvPOK must be true to acecss SvCUR of a PV.
> Doesn't make much sense to me.

Marc,

A couple of things - it was pointed out on IRC that the builds have
differing -DDEBUGGING build options, and that on the other versions, the
assertions which are being raised now might simply not be there.

The documentation that describes that a string must be POK before you
read SvCUR of it is in perlguts.  Don't forget than a SV is a union of
the various SV types, and that you need to check the bits to see what
the meaning of the subsequent members are.  Without SvPOK, you're
interpreting a field that is probably not what you expect.  Nicholas'
use of the private member is I think a red herring - but I'm not
entirely sure on that.

However I think there is more to this than that - I'm also a bit
confused as to why the sv_upgrade doesn't set the appropriate bits.  Is
it not just that the debugging version of the SvCUR macro is checking
the wrong bits?

Sam.



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