[New-bugs-announce] [issue12744] inefficient pickling of long integers on 64-bit builds
Antoine Pitrou
report at bugs.python.org
Fri Aug 12 18:26:23 CEST 2011
New submission from Antoine Pitrou <pitrou at free.fr>:
On a 64-bit Linux machine (where C `long` is 64 bits):
>>> len(pickle.dumps(2**30))
8
>>> len(pickle.dumps(2**31))
16
>>> len(pickle.dumps(2**62))
25
>>> len(pickle.dumps(2**63))
14
This is because the old text protocol is used when the integer can fit in a C long but not in 4 bytes:
>>> pickletools.dis(pickle.dumps(2**62))
0: \x80 PROTO 3
2: L LONG 4611686018427387904
24: . STOP
highest protocol among opcodes = 2
>>> pickletools.dis(pickle.dumps(2**63))
0: \x80 PROTO 3
2: \x8a LONG1 9223372036854775808
13: . STOP
highest protocol among opcodes = 2
----------
components: Library (Lib)
messages: 141971
nosy: pitrou
priority: normal
severity: normal
status: open
title: inefficient pickling of long integers on 64-bit builds
type: resource usage
versions: Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12744>
_______________________________________
More information about the New-bugs-announce
mailing list