Message119077
Am 18.10.2010 17:27, schrieb Antoine Pitrou:
>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
>> AFAICT, a change from (Py_ssize_t)-1 to (size_t)-1 is less likely to
>> break code than a change from -1L to (Py_ssize_t)-1. (Assuming a
>> sizeof(long) != sizeof(void*) platform.)
>
> That's true.
I don't think it is. Code that is changed to use the new return type
will not break in a change from long to Py_ssize_t, since all values
will sign-expand correctly, in all cases; the same is true if the new
return type was size_t. So for code that gets adjusted in its return
value, no breakage in either case.
For code that *doesn't* get adjusted, I'm still uncertain what will
happen. However, ISTM that if there is a cast to the "correct" function
pointer type, you get an incorrect detection of the guard value in
either case: e.g. on AMD64, the return value is in RAX, yet the hash
function may only fill out EAX. I'm not sure what values the upper
32 bits will have, but I doubt it gets sign-expanded - which it should
regardless of whether the expected value is (size_t)-1 or
(Py_ssize_t)-1. So you get breakage in either case.
Please correct me if I'm wrong. |
|
Date |
User |
Action |
Args |
2010-10-18 20:44:27 | loewis | set | recipients:
+ loewis, lemburg, tim.peters, skip.montanaro, georg.brandl, rhettinger, jimjjewett, mark.dickinson, belopolsky, pitrou, casevh, ked-tao, benjamin.peterson |
2010-10-18 20:44:25 | loewis | link | issue9778 messages |
2010-10-18 20:44:25 | loewis | create | |
|