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 3ddf983

Browse filesBrowse files
authored
gh-93096: Remove -t and -v flags from pickletools cli (#131039)
Remove `python -m pickletools -t`
1 parent 3bb20d1 commit 3ddf983
Copy full SHA for 3ddf983

File tree

Expand file treeCollapse file tree

2 files changed

+24
-33
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-33
lines changed

‎Lib/pickletools.py

Copy file name to clipboardExpand all lines: Lib/pickletools.py
+21-33Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,9 +2838,6 @@ def __init__(self, value):
28382838
'disassembler_memo_test': _memo_test,
28392839
}
28402840

2841-
def _test():
2842-
import doctest
2843-
return doctest.testmod()
28442841

28452842
if __name__ == "__main__":
28462843
import argparse
@@ -2865,36 +2862,27 @@ def _test():
28652862
'-p', '--preamble', default="==> {name} <==",
28662863
help='if more than one pickle file is specified, print this before'
28672864
' each disassembly')
2868-
parser.add_argument(
2869-
'-t', '--test', action='store_true',
2870-
help='run self-test suite')
2871-
parser.add_argument(
2872-
'-v', action='store_true',
2873-
help='run verbosely; only affects self-test run')
28742865
args = parser.parse_args()
2875-
if args.test:
2876-
_test()
2866+
if not args.pickle_file:
2867+
parser.print_help()
28772868
else:
2878-
if not args.pickle_file:
2879-
parser.print_help()
2869+
annotate = 30 if args.annotate else 0
2870+
memo = {} if args.memo else None
2871+
if args.output is None:
2872+
output = sys.stdout
28802873
else:
2881-
annotate = 30 if args.annotate else 0
2882-
memo = {} if args.memo else None
2883-
if args.output is None:
2884-
output = sys.stdout
2885-
else:
2886-
output = open(args.output, 'w')
2887-
try:
2888-
for arg in args.pickle_file:
2889-
if len(args.pickle_file) > 1:
2890-
name = '<stdin>' if arg == '-' else arg
2891-
preamble = args.preamble.format(name=name)
2892-
output.write(preamble + '\n')
2893-
if arg == '-':
2894-
dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
2895-
else:
2896-
with open(arg, 'rb') as f:
2897-
dis(f, output, memo, args.indentlevel, annotate)
2898-
finally:
2899-
if output is not sys.stdout:
2900-
output.close()
2874+
output = open(args.output, 'w')
2875+
try:
2876+
for arg in args.pickle_file:
2877+
if len(args.pickle_file) > 1:
2878+
name = '<stdin>' if arg == '-' else arg
2879+
preamble = args.preamble.format(name=name)
2880+
output.write(preamble + '\n')
2881+
if arg == '-':
2882+
dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
2883+
else:
2884+
with open(arg, 'rb') as f:
2885+
dis(f, output, memo, args.indentlevel, annotate)
2886+
finally:
2887+
if output is not sys.stdout:
2888+
output.close()
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Removed undocumented ``-t`` and ``-v`` arguments of ``python -m
2+
pickletools``. Use ``python -m doctest Lib/pickletools.py -v`` instead.
3+
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.