mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
save_int(): Fixed two new off-by-1 glitches.
This commit is contained in:
parent
e0b904232f
commit
8fda7bc48d
1 changed files with 2 additions and 2 deletions
|
@ -368,10 +368,10 @@ class Pickler:
|
|||
# case.
|
||||
# First one- and two-byte unsigned ints:
|
||||
if object >= 0:
|
||||
if object < 0xff:
|
||||
if object <= 0xff:
|
||||
self.write(BININT1 + chr(object))
|
||||
return
|
||||
if object < 0xffff:
|
||||
if object <= 0xffff:
|
||||
self.write(BININT2 + chr(object&0xff) + chr(object>>8))
|
||||
return
|
||||
# Next check for 4-byte signed ints:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue