mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (#4407)
This commit is contained in:
parent
0a2abdfca2
commit
3daaafb700
5 changed files with 69 additions and 62 deletions
|
@ -674,7 +674,10 @@ class _Pickler:
|
|||
else:
|
||||
self.write(LONG4 + pack("<i", n) + encoded)
|
||||
return
|
||||
self.write(LONG + repr(obj).encode("ascii") + b'L\n')
|
||||
if -0x80000000 <= obj <= 0x7fffffff:
|
||||
self.write(INT + repr(obj).encode("ascii") + b'\n')
|
||||
else:
|
||||
self.write(LONG + repr(obj).encode("ascii") + b'L\n')
|
||||
dispatch[int] = save_long
|
||||
|
||||
def save_float(self, obj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue