mirror of
https://github.com/python/cpython.git
synced 2025-10-24 07:26:11 +00:00
gh-93096: Remove -t and -v flags from pickletools cli (#131039)
Remove `python -m pickletools -t`
This commit is contained in:
parent
3bb20d13a8
commit
3ddf983afd
2 changed files with 24 additions and 33 deletions
|
|
@ -2838,9 +2838,6 @@ __test__ = {'disassembler_test': _dis_test,
|
||||||
'disassembler_memo_test': _memo_test,
|
'disassembler_memo_test': _memo_test,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _test():
|
|
||||||
import doctest
|
|
||||||
return doctest.testmod()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import argparse
|
import argparse
|
||||||
|
|
@ -2865,36 +2862,27 @@ if __name__ == "__main__":
|
||||||
'-p', '--preamble', default="==> {name} <==",
|
'-p', '--preamble', default="==> {name} <==",
|
||||||
help='if more than one pickle file is specified, print this before'
|
help='if more than one pickle file is specified, print this before'
|
||||||
' each disassembly')
|
' each disassembly')
|
||||||
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()
|
args = parser.parse_args()
|
||||||
if args.test:
|
if not args.pickle_file:
|
||||||
_test()
|
parser.print_help()
|
||||||
else:
|
else:
|
||||||
if not args.pickle_file:
|
annotate = 30 if args.annotate else 0
|
||||||
parser.print_help()
|
memo = {} if args.memo else None
|
||||||
|
if args.output is None:
|
||||||
|
output = sys.stdout
|
||||||
else:
|
else:
|
||||||
annotate = 30 if args.annotate else 0
|
output = open(args.output, 'w')
|
||||||
memo = {} if args.memo else None
|
try:
|
||||||
if args.output is None:
|
for arg in args.pickle_file:
|
||||||
output = sys.stdout
|
if len(args.pickle_file) > 1:
|
||||||
else:
|
name = '<stdin>' if arg == '-' else arg
|
||||||
output = open(args.output, 'w')
|
preamble = args.preamble.format(name=name)
|
||||||
try:
|
output.write(preamble + '\n')
|
||||||
for arg in args.pickle_file:
|
if arg == '-':
|
||||||
if len(args.pickle_file) > 1:
|
dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
|
||||||
name = '<stdin>' if arg == '-' else arg
|
else:
|
||||||
preamble = args.preamble.format(name=name)
|
with open(arg, 'rb') as f:
|
||||||
output.write(preamble + '\n')
|
dis(f, output, memo, args.indentlevel, annotate)
|
||||||
if arg == '-':
|
finally:
|
||||||
dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
|
if output is not sys.stdout:
|
||||||
else:
|
output.close()
|
||||||
with open(arg, 'rb') as f:
|
|
||||||
dis(f, output, memo, args.indentlevel, annotate)
|
|
||||||
finally:
|
|
||||||
if output is not sys.stdout:
|
|
||||||
output.close()
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
Removed undocumented ``-t`` and ``-v`` arguments of ``python -m
|
||||||
|
pickletools``. Use ``python -m doctest Lib/pickletools.py -v`` instead.
|
||||||
|
Patch by Semyon Moroz.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue