diff options
author | Guido van Rossum <guido@python.org> | 2003-01-28 04:25:27 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-01-28 04:25:27 (GMT) |
commit | 7d97d31a1b254104037c3653fa2229cb273fa713 (patch) | |
tree | 6351bae93fc3163346be99c6f2356b27ea7cd0a7 /Lib/pickle.py | |
parent | 025bc2fe6c1d71505b95b6351795cba7724fd45f (diff) | |
download | cpython-7d97d31a1b254104037c3653fa2229cb273fa713.zip cpython-7d97d31a1b254104037c3653fa2229cb273fa713.tar.gz cpython-7d97d31a1b254104037c3653fa2229cb273fa713.tar.bz2 |
OK, this is really the last one tonight!
NEWFALSE and NEWTRUE.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index aa67ed1..95bdd26 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -356,7 +356,10 @@ class Pickler: dispatch[NoneType] = save_none def save_bool(self, object): - self.write(object and TRUE or FALSE) + if self.proto >= 2: + self.write(object and NEWTRUE or NEWFALSE) + else: + self.write(object and TRUE or FALSE) dispatch[bool] = save_bool def save_int(self, object, pack=struct.pack): @@ -760,6 +763,14 @@ class Unpickler: self.append(None) dispatch[NONE] = load_none + def load_false(self): + self.append(False) + dispatch[NEWFALSE] = load_false + + def load_true(self): + self.append(True) + dispatch[NEWTRUE] = load_true + def load_int(self): data = self.readline() if data == FALSE[1:]: |