save_int(): Fixed two new off-by-1 glitches.

This commit is contained in:
Tim Peters 2003-01-28 03:40:52 +00:00
parent e0b904232f
commit 8fda7bc48d
1 changed files with 2 additions and 2 deletions

View File

@ -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: