Message81376
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. |
|
Date |
User |
Action |
Args |
2009-02-08 12:45:41 | mark.dickinson | set | recipients:
+ mark.dickinson, dalcinl |
2009-02-08 12:45:41 | mark.dickinson | set | messageid: <1234097141.27.0.422453115875.issue5175@psf.upfronthosting.co.za> |
2009-02-08 12:45:40 | mark.dickinson | link | issue5175 messages |
2009-02-08 12:45:38 | mark.dickinson | create | |
|