https://github.com/python/cpython/commit/425e0af74fb882b95f81923123bd4afad0cda157 commit: 425e0af74fb882b95f81923123bd4afad0cda157 branch: main author: donBarbos <donbar...@proton.me> committer: vstinner <vstin...@python.org> date: 2025-03-11T12:07:00+01:00 summary:
gh-93096: Remove `-t` and `-v` flags from `pickle` cli (#131068) * Remove `python -m pickle -t` * Revert adding doctest to unittests files: A Misc/NEWS.d/next/Library/2025-03-11-08-07-07.gh-issue-93096.DyPXUX.rst M Lib/pickle.py diff --git a/Lib/pickle.py b/Lib/pickle.py index 8afb4aa4285f37..8f7406d2534f2c 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -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 @@ -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) diff --git a/Misc/NEWS.d/next/Library/2025-03-11-08-07-07.gh-issue-93096.DyPXUX.rst b/Misc/NEWS.d/next/Library/2025-03-11-08-07-07.gh-issue-93096.DyPXUX.rst new file mode 100644 index 00000000000000..919cc43cd6b200 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-03-11-08-07-07.gh-issue-93096.DyPXUX.rst @@ -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. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com