[Python-checkins] CVS: python/dist/src/Lib/test test_cpickle.py,1.4,1.5
Guido van Rossum
python-dev@python.org
Fri, 21 Apr 2000 16:50:01 -0400 (EDT)
Update of /projects/cvsroot/python/dist/src/Lib/test
In directory eric:/projects/python/develop/guido/src/Lib/test
Modified Files:
test_cpickle.py
Log Message:
Charles Waldman writes:
"""
In the course of debugging this I also saw that cPickle is
inconsistent with pickle - if you attempt a pickle.load or pickle.dump
on a closed file, you get a ValueError, whereas the corresponding
cPickle operations give an IOError. Since cPickle is advertised as
being compatible with pickle, I changed these exceptions to match.
"""
Index: test_cpickle.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_cpickle.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_cpickle.py 1999/07/13 15:23:42 1.4
--- test_cpickle.py 2000/04/21 20:49:58 1.5
***************
*** 80,95 ****
try:
cPickle.dump(123, f)
! except IOError:
pass
else:
! print "dump to closed file should raise IOError"
f = open(fn, "r")
f.close()
try:
cPickle.load(f)
! except IOError:
pass
else:
! print "load from closed file should raise IOError"
os.remove(fn)
--- 80,95 ----
try:
cPickle.dump(123, f)
! except ValueError:
pass
else:
! print "dump to closed file should raise ValueError"
f = open(fn, "r")
f.close()
try:
cPickle.load(f)
! except ValueError:
pass
else:
! print "load from closed file should raise ValueError"
os.remove(fn)