Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 425e0af

Browse filesBrowse files
authored
gh-93096: Remove -t and -v flags from pickle cli (#131068)
* Remove `python -m pickle -t` * Revert adding doctest to unittests
1 parent 3ddf983 commit 425e0af
Copy full SHA for 425e0af

File tree

Expand file treeCollapse file tree

2 files changed

+12
-23
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-23
lines changed

‎Lib/pickle.py

Copy file name to clipboardExpand all lines: Lib/pickle.py
+10-23Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,10 +1906,6 @@ def _loads(s, /, *, fix_imports=True, encoding="ASCII", errors="strict",
19061906
Pickler, Unpickler = _Pickler, _Unpickler
19071907
dump, dumps, load, loads = _dump, _dumps, _load, _loads
19081908

1909-
# Doctest
1910-
def _test():
1911-
import doctest
1912-
return doctest.testmod()
19131909

19141910
if __name__ == "__main__":
19151911
import argparse
@@ -1918,24 +1914,15 @@ def _test():
19181914
parser.add_argument(
19191915
'pickle_file',
19201916
nargs='*', help='the pickle file')
1921-
parser.add_argument(
1922-
'-t', '--test', action='store_true',
1923-
help='run self-test suite')
1924-
parser.add_argument(
1925-
'-v', action='store_true',
1926-
help='run verbosely; only affects self-test run')
19271917
args = parser.parse_args()
1928-
if args.test:
1929-
_test()
1918+
if not args.pickle_file:
1919+
parser.print_help()
19301920
else:
1931-
if not args.pickle_file:
1932-
parser.print_help()
1933-
else:
1934-
import pprint
1935-
for fn in args.pickle_file:
1936-
if fn == '-':
1937-
obj = load(sys.stdin.buffer)
1938-
else:
1939-
with open(fn, 'rb') as f:
1940-
obj = load(f)
1941-
pprint.pprint(obj)
1921+
import pprint
1922+
for fn in args.pickle_file:
1923+
if fn == '-':
1924+
obj = load(sys.stdin.buffer)
1925+
else:
1926+
with open(fn, 'rb') as f:
1927+
obj = load(f)
1928+
pprint.pprint(obj)
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed undocumented ``-t`` and ``-v`` arguments of ``python -m pickle``.
2+
Use ``python -m doctest Lib/pickle.py -v`` instead. Patch by Semyon Moroz.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.