]> granicus.if.org Git - python/commitdiff
save_int(): Fixed two new off-by-1 glitches.
authorTim Peters <tim.peters@gmail.com>
Tue, 28 Jan 2003 03:40:52 +0000 (03:40 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 28 Jan 2003 03:40:52 +0000 (03:40 +0000)
Lib/pickle.py

index cb27f8ab859af94db868c98eb99a2576f2e2d085..ab5fcb6113b353787536699e788f573d6ee130b9 100644 (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: