Author mark.dickinson
Recipients dalcinl, mark.dickinson
Date 2009-02-08.12:45:38
SpamBayes Score 3.99725e-09
Marked as misclassified No
Message-id <1234097141.27.0.422453115875.issue5175@psf.upfronthosting.co.za>
In-reply-to
Content
This also affects 3.1.

Note that the current behaviour (or rather, its effects in 
PyLong_AsUnsignedLongLong) is as documented.  In

http://docs.python.org/dev/c-api/long.html

it says for PyLong_AsUnsignedLongLong:

"Return a C unsigned long long from a Python long integer. If pylong 
cannot be represented as an unsigned long long, an OverflowError will be 
raised if the value is positive, or a TypeError will be raised if the 
value is negative."

...which suggests that the choice of TypeError was intentional.  It 
still seems wrong to me, though: the argument has the correct type, but 
an illegal value, so ValueError or (for consistency with the other 
methods) OverflowError would seem more appropriate.

If this change is made, then test_struct needs fixing: the change 
affects the 'Q' struct format.  I don't think the change in struct 
behaviour is serious, since there's very little consistency between 
different struct types at the moment:  for negative ints, 'Q' raises an 
error, 'L' and 'I' give a DeprecationWarning, and 'H' raises a 
struct.error.
History
Date User Action Args
2009-02-08 12:45:41mark.dickinsonsetrecipients: + mark.dickinson, dalcinl
2009-02-08 12:45:41mark.dickinsonsetmessageid: <1234097141.27.0.422453115875.issue5175@psf.upfronthosting.co.za>
2009-02-08 12:45:40mark.dickinsonlinkissue5175 messages
2009-02-08 12:45:38mark.dickinsoncreate