gh-93096: Remove -t and -v flags from pickle cli (#131068)

* Remove `python -m pickle -t`

* Revert adding doctest to unittests
This commit is contained in:
donBarbos 2025-03-11 15:07:00 +04:00 committed by GitHub
parent 3ddf983afd
commit 425e0af74f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 23 deletions

View file

@ -1906,10 +1906,6 @@ except ImportError:
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
@ -1918,24 +1914,15 @@ if __name__ == "__main__":
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)

View file

@ -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.