[Python-Dev] 2.5, 64 bit (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Mon Oct 9 19:53:23 CEST 2006


Kristján V. Jónsson schrieb:

the VisualStudio8 64 bit build of 2.5 doesn't compile clean. We have a number of warnings of truncation from 64 bit to 32: Often it is a question of doing an explicit cast, but sometimes we are using "int" for results from strlen and such.

Is there any interest in fixing this up?

Yes; I had fixed many of them already for the Python 2.5 release (there were way more of these before I started).

Notice that many of them are bogus. For example, if I do strlen on a buffer that is known to have MAXPATH bytes, the strlen result can't exceed an int. So care is necessary for each case:

IIRC, the biggest chunk of "real" work left is SRE: this can realistically overflow when it operates on large strings. You have to really understand SRE before fixing it. For example, I believe that large strings might have impacts on compilation, too (e.g. if the regex itself is >2GiB, or some repetition count is >2**31). In these cases, it might be saner to guarantee an exception (and document the limitation) than to try expanding the SRE bytecode.

Another set of remaining changes deals with limitations on byte code and reflection. For example, there is currently a limit on the number of local variables imposed by the Python bytecode. From this limit, it follows that certain casts are correct. One should document each limit first, and then refer to these limits when adding casts.

Helping here would be definitely appreciated.

Regards, Martin



More information about the Python-Dev mailing list