diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-04-10 05:02:52 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-04-10 05:02:52 (GMT) |
commit | 44714007e888acba27d8527122bf618c28a4120b (patch) | |
tree | 2d100e6115c29f4e73644aa8a5c769970719d7d9 /Python/marshal.c | |
parent | d8ae7c2999b0362c098e57d64f49a710ce8238d0 (diff) | |
download | cpython-44714007e888acba27d8527122bf618c28a4120b.zip cpython-44714007e888acba27d8527122bf618c28a4120b.tar.gz cpython-44714007e888acba27d8527122bf618c28a4120b.tar.bz2 |
test_pickle works on sizeof(long)==8 boxes again.
pickle.py
The code implicitly assumed that all ints fit in 4 bytes, causing all
sorts of mischief (from nonsense results to corrupted pickles).
Repaired that.
marshal.c
The int marshaling code assumed that right shifts of signed longs
sign-extend. Repaired that.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r-- | Python/marshal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index 1b9ab9a..120c3fa 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -126,7 +126,7 @@ w_object(PyObject *v, WFILE *p) else if (PyInt_Check(v)) { long x = PyInt_AS_LONG((PyIntObject *)v); #if SIZEOF_LONG > 4 - long y = x>>31; + long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31); if (y && y != -1) { w_byte(TYPE_INT64, p); w_long64(x, p); |