Martin v. Löwis <mar...@v.loewis.de> added the comment: Am 18.10.2010 17:27, schrieb Antoine Pitrou: > > Antoine Pitrou <pit...@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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9778> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com