This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients belopolsky, christian.heimes, edahl, georg.brandl, mark.dickinson, mwh, ronaldoussoren, tim.peters
Date 2008-07-21.21:56:35
SpamBayes Score 0.006231601
Marked as misclassified No
Message-id <1216677397.28.0.783529375377.issue1481296@psf.upfronthosting.co.za>
In-reply-to
Content
I still think this is the wrong solution, and should be fixed before 2.6; 
long(float('nan')) should raise ValueError.  As Alexander points out, 
this fits much better with the IEEE 754 standard, and also with the C99 
standard.  It also just "feels right", to me; an attempt to convert a nan 
to an integer should not pass silently.

Here's a patch, based on Ronald's original patch.

Christian, what was the motivation for returning 0 here?

(One could also argue on the basis of IEEE 754 and C99 that 
long(float('inf')) should raise ValueError instead of OverflowError;  
personally, I'm content that long(float('inf')) raises an exception---I'm 
not too bothered which one.)

I agree that there doesn't seem much value in backporting the fix.
History
Date User Action Args
2008-07-21 21:56:37mark.dickinsonsetspambayes_score: 0.0062316 -> 0.006231601
recipients: + mark.dickinson, mwh, tim.peters, georg.brandl, ronaldoussoren, belopolsky, edahl, christian.heimes
2008-07-21 21:56:37mark.dickinsonsetspambayes_score: 0.0062316 -> 0.0062316
messageid: <1216677397.28.0.783529375377.issue1481296@psf.upfronthosting.co.za>
2008-07-21 21:56:36mark.dickinsonlinkissue1481296 messages
2008-07-21 21:56:36mark.dickinsoncreate