Issue #15466: Stop using TYPE_INT64 in marshal,

to make importlib.h (and other byte code files) equal between 32-bit
and 64-bit systems.
This commit is contained in:
Martin v. Löwis 2012-07-28 19:44:05 +02:00
parent 5562d9dc5d
commit 7e39572aa8
3 changed files with 2357 additions and 2360 deletions

View File

@ -10,6 +10,9 @@ What's New in Python 3.3.0 Beta 2?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #15466: Stop using TYPE_INT64 in marshal, to make bytecode
files
- Issue #1692335: Move initial args assignment to - Issue #1692335: Move initial args assignment to
BaseException.__new__ to help pickling of naive subclasses. BaseException.__new__ to help pickling of naive subclasses.

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,9 @@
#define TYPE_STOPITER 'S' #define TYPE_STOPITER 'S'
#define TYPE_ELLIPSIS '.' #define TYPE_ELLIPSIS '.'
#define TYPE_INT 'i' #define TYPE_INT 'i'
/* TYPE_INT64 is deprecated. It is not
generated anymore, and support for reading it
will be removed in Python 3.4. */
#define TYPE_INT64 'I' #define TYPE_INT64 'I'
#define TYPE_FLOAT 'f' #define TYPE_FLOAT 'f'
#define TYPE_BINARY_FLOAT 'g' #define TYPE_BINARY_FLOAT 'g'
@ -121,15 +124,6 @@ w_long(long x, WFILE *p)
w_byte((char)((x>>24) & 0xff), p); w_byte((char)((x>>24) & 0xff), p);
} }
#if SIZEOF_LONG > 4
static void
w_long64(long x, WFILE *p)
{
w_long(x, p);
w_long(x>>32, p);
}
#endif
/* We assume that Python longs are stored internally in base some power of /* We assume that Python longs are stored internally in base some power of
2**15; for the sake of portability we'll always read and write them in base 2**15; for the sake of portability we'll always read and write them in base
exactly 2**15. */ exactly 2**15. */
@ -219,8 +213,8 @@ w_object(PyObject *v, WFILE *p)
#if SIZEOF_LONG > 4 #if SIZEOF_LONG > 4
long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31); long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31);
if (y && y != -1) { if (y && y != -1) {
w_byte(TYPE_INT64, p); /* Too large for TYPE_INT */
w_long64(x, p); w_PyLong((PyLongObject*)v, p);
} }
else else
#endif #endif