Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1906,10 +1906,6 @@ def _loads(s, /, *, fix_imports=True, encoding="ASCII", errors="strict",
Pickler, Unpickler = _Pickler, _Unpickler
dump, dumps, load, loads = _dump, _dumps, _load, _loads

# Doctest
def _test():
import doctest
return doctest.testmod()

if __name__ == "__main__":
import argparse
Expand All @@ -1918,24 +1914,15 @@ def _test():
parser.add_argument(
'pickle_file',
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()
if not args.pickle_file:
parser.print_help()
else:
if not args.pickle_file:
parser.print_help()
else:
import pprint
for fn in args.pickle_file:
if fn == '-':
obj = load(sys.stdin.buffer)
else:
with open(fn, 'rb') as f:
obj = load(f)
pprint.pprint(obj)
import pprint
for fn in args.pickle_file:
if fn == '-':
obj = load(sys.stdin.buffer)
else:
with open(fn, 'rb') as f:
obj = load(f)
pprint.pprint(obj)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed undocumented ``-t`` and ``-v`` arguments of ``python -m pickle``.
Use ``python -m doctest Lib/pickle.py -v`` instead. Patch by Semyon Moroz.
Loading