Message1144

Author nobody
Recipients
Date 2006-06-06.07:41:02
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2008-02-20 17:17:30adminlinkissue1501448 messages
2008-02-20 17:17:30admincreate