diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-14 20:40:13 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-14 20:40:13 (GMT) |
commit | ad2dc3fc4427c640fbdc098922c9921e0f8894c0 (patch) | |
tree | 01beb26154f66fd57ea5d317e48b16c1664d7f9c /Doc/lib/libmarshal.tex | |
parent | c785f4841c24ff912ab5cc1ab34da4b9d64205e5 (diff) | |
download | cpython-ad2dc3fc4427c640fbdc098922c9921e0f8894c0.zip cpython-ad2dc3fc4427c640fbdc098922c9921e0f8894c0.tar.gz cpython-ad2dc3fc4427c640fbdc098922c9921e0f8894c0.tar.bz2 |
Update the warning about transporting marshals across boxes with different
ideas about sizeof(long).
Diffstat (limited to 'Doc/lib/libmarshal.tex')
-rw-r--r-- | Doc/lib/libmarshal.tex | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/Doc/lib/libmarshal.tex b/Doc/lib/libmarshal.tex index 5686451..cd38a8c 100644 --- a/Doc/lib/libmarshal.tex +++ b/Doc/lib/libmarshal.tex @@ -39,19 +39,14 @@ therein are themselves supported; and recursive lists and dictionaries should not be written (they will cause infinite loops). \strong{Caveat:} On machines where C's \code{long int} type has more than -32 bits (such as the DEC Alpha), it -is possible to create plain Python integers that are longer than 32 -bits. Since the current \module{marshal} module uses 32 bits to -transfer plain Python integers, such values are silently truncated. -This particularly affects the use of very long integer literals in -Python modules --- these will be accepted by the parser on such -machines, but will be silently be truncated when the module is read -from the \file{.pyc} instead.\footnote{ - A solution would be to refuse such literals in the parser, - since they are inherently non-portable. Another solution would be to - let the \module{marshal} module raise an exception when an integer - value would be truncated. At least one of these solutions will be - implemented in a future version.} +32 bits (such as the DEC Alpha), it is possible to create plain Python +integers that are longer than 32 bits. +If such an integer is marshaled and read back in on a machine where +C's \code{long int} type has only 32 bits, a Python long integer object +is returned instead. While of a different type, the numeric value is +the same. (This behavior is new in Python 2.2. In earlier versions, +all but the least-significant 32 bits of the value were lost, and a +warning message was printed.) There are functions that read/write files as well as functions operating on strings. |