Issue1501448

classification
Title: None not unserialised properly
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: kzuberi
Priority: normal Keywords:

Created on 2006-06-06.07:41:02 by anonymous, last changed 2006-08-23.21:00:40 by kzuberi.

Messages
msg1144 (view) Author: Nobody/Anonymous (nobody) Date: 2006-06-06.07:41:02
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.
msg1145 (view) Author: Khalid Zuberi (kzuberi) Date: 2006-08-23.21:00:40
Logged In: YES 
user_id=18288


The given sample code runs successfully with current 2.2
development. Also, the testcase test_singletons in
test_jser2.py seems to cover this. As 2.1 is unlikely to see
further maintenance, I'm marking this as closed.

- kz
History
Date User Action Args
2006-06-06 07:41:02anonymouscreate