Message3241

Author pjenvey
Recipients cgroves, mehendran, pjenvey
Date 2008-06-08.00:18:14
SpamBayes Score 0.013601921
Marked as misclassified No
Message-id <1212884295.42.0.626063314578.issue1758325@psf.upfronthosting.co.za>
In-reply-to
Content
The root of the problem is that PyString defines an __int__ method. 
__int__ is being used by the string formatter to convert any object to a 
number.

__int__ is really equivalent to CPython's tp_as_number nb_int. The 
tp_as_number interface in CPython is only defined for actual number 
types (float/long etc), not string.

__int__ really *is* what the string formatter should be calling (to get 
an integer from strictly numeric types) but the fact that PyString 
provides it means we get a conversion instead of an error here

CPython converts strings to ints (int('foo')) in a more explicit way; it 
first looks for the tp_as_number interface, and if that's not supported, 
explicitly checks for strings
History
Date User Action Args
2008-06-08 00:18:15pjenveysetspambayes_score: 0.0136019 -> 0.013601921
messageid: <1212884295.42.0.626063314578.issue1758325@psf.upfronthosting.co.za>
2008-06-08 00:18:15pjenveysetspambayes_score: 0.0136019 -> 0.0136019
recipients: + pjenvey, cgroves, mehendran
2008-06-08 00:18:15pjenveylinkissue1758325 messages
2008-06-08 00:18:14pjenveycreate