]> granicus.if.org Git - python/commitdiff
Charles Waldman writes:
authorGuido van Rossum <guido@python.org>
Fri, 21 Apr 2000 20:49:58 +0000 (20:49 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 21 Apr 2000 20:49:58 +0000 (20:49 +0000)
"""
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.
"""

Lib/test/test_cpickle.py

index 7cc4b1fccca73af9b90de1b57f63aefb3f245f1a..f5e920fd49eea71947c50cc01c73793e84c0c81b 100644 (file)
@@ -79,18 +79,18 @@ def dotest():
     f.close()
     try:
         cPickle.dump(123, f)
-    except IOError:
+    except ValueError:
         pass
     else:
-        print "dump to closed file should raise IOError"
+        print "dump to closed file should raise ValueError"
     f = open(fn, "r")
     f.close()
     try:
         cPickle.load(f)
-    except IOError:
+    except ValueError:
         pass
     else:
-        print "load from closed file should raise IOError"
+        print "load from closed file should raise ValueError"
     os.remove(fn)
 
     # Test specific bad cases