This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients pitrou
Date 2011-08-12.16:26:22
SpamBayes Score 0.0063172216
Marked as misclassified No
Message-id <1313166383.93.0.380939327922.issue12744@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-08-12 16:26:24pitrousetrecipients: + pitrou
2011-08-12 16:26:23pitrousetmessageid: <1313166383.93.0.380939327922.issue12744@psf.upfronthosting.co.za>
2011-08-12 16:26:23pitroulinkissue12744 messages
2011-08-12 16:26:22pitroucreate