RE: [tcltk-perl] return of 1=>1.0 transformation error
Brought to you by:
hobbs
From: Jan D. <ja...@Ac...> - 2004-04-28 16:53:16
|
> > Tcl error 'bad grid value "1.0": must be a non-negative > > integer at d:/Perl56/site/lib/Tcl.pm line 363. ' while > > invoking scalar result call: > > "grid .lbl02 -row 1 -column 0" at > ... > > perl-5.8.2 passes test without this error, 5.6.0 and 5.6.1 fail. > > This is specifically supposed to be handled by this code in > TclObjFromSv: > > else if (SvNOK(sv)) { > double dval = SvNV(sv); > int ival; > /* > * Account for some perl versions aggressive NOK-ness where > * an int was all that was intented. > */ > if (SvIOK(sv) && ((double)(ival = SvIV(sv)) == dval)) { > objPtr = Tcl_NewIntObj(ival); > } else { > objPtr = Tcl_NewDoubleObj(dval); > } > } > > as it was an issue that 5.6 decided to aggressively promote > "1" with SvNOK as well as SvIOK, whereas 5.8 is corrected to > not do that. That code will not catch the case when the floating point value has already been stringified. What is weird thought is that Perl would still stringify an NV of value 1.0 as "1" and not "1.0". So is it possible that the value already got round-tripped through Tcl? Cheers, -Jan |