[Python-checkins] r83188 - in python/branches/py3k: Lib/pickle.py Misc/NEWS
alexander.belopolsky
python-checkins at python.org
Wed Jul 28 01:02:38 CEST 2010
Author: alexander.belopolsky
Date: Wed Jul 28 01:02:38 2010
New Revision: 83188
Log:
Issue #9378: python -m pickle <pickle file> will now load and display
the first object in the pickle file.
Modified:
python/branches/py3k/Lib/pickle.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/pickle.py
==============================================================================
--- python/branches/py3k/Lib/pickle.py (original)
+++ python/branches/py3k/Lib/pickle.py Wed Jul 28 01:02:38 2010
@@ -1322,4 +1322,26 @@
return doctest.testmod()
if __name__ == "__main__":
- _test()
+ import sys, argparse
+ parser = argparse.ArgumentParser(
+ description='display contents of the pickle files')
+ parser.add_argument(
+ 'pickle_file', type=argparse.FileType('br'),
+ nargs='*', help='the pickle file')
+ parser.add_argument(
+ '-t', '--test', action='store_true',
+ help='run self-test suite')
+ parser.add_argument(
+ '-v', action='store_true',
+ help='run verbosely; only affects self-test run')
+ args = parser.parse_args()
+ if args.test:
+ _test()
+ else:
+ if not args.pickle_file:
+ parser.print_help()
+ else:
+ import pprint
+ for f in args.pickle_file:
+ obj = load(f)
+ pprint.pprint(obj)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Jul 28 01:02:38 2010
@@ -473,6 +473,9 @@
Library
-------
+- Issue #9378: python -m pickle <pickle file> will now load and
+ display the first object in the pickle file.
+
- Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of
``raw-unicode-escape`` before ASCII-to-binary decoding.
More information about the Python-checkins
mailing list