diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-11-13 22:01:27 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-11-13 22:01:27 (GMT) |
commit | 5e0f4e73a963a69b0ecd16e2477d6cd2cacef6c9 (patch) | |
tree | 44ef072c63525fcb6ff5055907de583bc9f459a2 /Lib/pickle.py | |
parent | 0e1183ddffd1363ffce6b4792f5b82a8d3a9e5a8 (diff) | |
download | cpython-5e0f4e73a963a69b0ecd16e2477d6cd2cacef6c9.zip cpython-5e0f4e73a963a69b0ecd16e2477d6cd2cacef6c9.tar.gz cpython-5e0f4e73a963a69b0ecd16e2477d6cd2cacef6c9.tar.bz2 |
Remove inst_persistent_id() WANNI (we ain't never needed it).
Add some simple tests of the persistence hooks.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index 954da4e..a8b2b51 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -188,14 +188,13 @@ class Pickler: return GET + `i` + '\n' - def save(self, object, pers_save = 0): + def save(self, object): memo = self.memo - if not pers_save: - pid = self.persistent_id(object) - if pid is not None: - self.save_pers(pid) - return + pid = self.persistent_id(object) + if pid is not None: + self.save_pers(pid) + return d = id(object) @@ -215,11 +214,6 @@ class Pickler: try: f = self.dispatch[t] except KeyError: - pid = self.inst_persistent_id(object) - if pid is not None: - self.save_pers(pid) - return - try: issc = issubclass(t, TypeType) except TypeError: # t is not a class @@ -279,14 +273,11 @@ class Pickler: def persistent_id(self, object): return None - def inst_persistent_id(self, object): - return None - def save_pers(self, pid): if not self.bin: self.write(PERSID + str(pid) + '\n') else: - self.save(pid, 1) + self.save(pid) self.write(BINPERSID) def save_reduce(self, callable, arg_tup, state = None): |