Message1144
When serialising/unserialising an array (or dictionary)
containing None, it is not unserialised properly.
The following code shows the problem.
Jython version:
Jython 2.1 on java1.5.0_06 (JIT: null)
-----------------------
from java import io
def loadObject(fName):
f = io.FileInputStream(fName)
ins=io.ObjectInputStream(f)
x=ins.readObject()
ins.close()
return x
def saveObject(fName,x):
f = io.FileOutputStream(fName)
outs=io.ObjectOutputStream(f)
outs.writeObject(x)
outs.close()
a1 = [None]
saveObject("array.obj", a1)
a2 = loadObject("array.obj")
print a1[0] == None # => 1, correct.
print a2[0] == None # => 0, wrong! should be true.
print a1[0] == a2[0] # => 0, wrong! should be true.
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:30 | admin | link | issue1501448 messages |
2008-02-20 17:17:30 | admin | create | |
|