Commit ff27607e authored by Jim Fulton's avatar Jim Fulton

Fixed bugs including handling of ZClasses created with

BoboPOS2.
parent 5a96e757
...@@ -228,7 +228,8 @@ class Global: ...@@ -228,7 +228,8 @@ class Global:
def __call__(self, *args): def __call__(self, *args):
return Inst(self, args) return Inst(self, args)
__basicnew__=__call__ def __basicnew__(self):
return Inst(self, None)
def _global(m, n): def _global(m, n):
if m[:8]=='BoboPOS.': if m[:8]=='BoboPOS.':
...@@ -236,6 +237,8 @@ def _global(m, n): ...@@ -236,6 +237,8 @@ def _global(m, n):
m='ZODB.conversionhack' m='ZODB.conversionhack'
n='hack' n='hack'
elif m=='BoboPOS.PersistentMapping': m='Persistence' elif m=='BoboPOS.PersistentMapping': m='Persistence'
elif m=='BoboPOS.cPickleJar' and n=='ec':
m=n='ExtensionClass'
else: else:
raise 'Unexpected BoboPOS class', (m, n) raise 'Unexpected BoboPOS class', (m, n)
...@@ -253,7 +256,7 @@ class Inst: ...@@ -253,7 +256,7 @@ class Inst:
def __setstate__(self, state): self._state=state def __setstate__(self, state): self._state=state
from pickle import INST, GLOBAL, MARK, BUILD, OBJ from pickle import INST, GLOBAL, MARK, BUILD, OBJ, REDUCE
InstanceType=type(Ghost()) InstanceType=type(Ghost())
...@@ -320,18 +323,11 @@ class Pickler(pickle.Pickler): ...@@ -320,18 +323,11 @@ class Pickler(pickle.Pickler):
memo[d] = (memo_len, object) memo[d] = (memo_len, object)
return return
args=object._args
write(MARK)
self.save_inst(object._cls) self.save_inst(object._cls)
save(object._args)
if args:
for arg in args:
save(arg)
memo_len = len(memo) memo_len = len(memo)
write(OBJ + self.put(len(memo))) write(REDUCE + self.put(memo_len))
memo[d] = (memo_len, object) memo[d] = (memo_len, object)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment