Re: [tcltk-perl] return of 1=>1.0 transformation error
Brought to you by:
hobbs
From: Gisle A. <gi...@Ac...> - 2004-04-28 16:42:03
|
"Jeff Hobbs" <je...@Ac...> writes: > > 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)) { I think you should remove the SvIOK() test here. Then it should work even for SVs where only the NOK flag is set, but still contains a whole duble. That might happen as well. This will have problem with very large values though. Hmm. You probably also need to test that dval is within the integer range. > 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. > > Jeff > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Tcltk-perl mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcltk-perl |