[Python-checkins] CVS: python/dist/src/Lib/test test_bool.py,1.1,1.2
Guido van Rossum
gvanrossum@users.sourceforge.net
Fri, 05 Apr 2002 11:30:10 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv8192/Lib/test
Modified Files:
test_bool.py
Log Message:
Implement an idea by Paul Rubin:
Change pickling format for bools to use a backwards compatible
encoding. This means you can pickle True or False on Python 2.3
and Python 2.2 or before will read it back as 1 or 0. The code
used for pickling bools before would create pickles that could
not be read in previous Python versions.
Index: test_bool.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_bool.py 3 Apr 2002 23:01:45 -0000 1.1
--- test_bool.py 5 Apr 2002 19:30:08 -0000 1.2
***************
*** 225,228 ****
--- 225,234 ----
veris(cPickle.loads(pickle.dumps(False)), False)
+ # Test for specific backwards-compatible pickle values
+ vereq(pickle.dumps(True), "I01\n.")
+ vereq(pickle.dumps(False), "I00\n.")
+ vereq(cPickle.dumps(True), "I01\n.")
+ vereq(cPickle.dumps(False), "I00\n.")
+
if verbose:
print "All OK"