Update pickletools from CPython 3.12.3

This commit is contained in:
CPython Developers authored and Jeong YunWon committed 2024-04-23 18:05:50 +09:00
1 parent ca2c1d0b48
commit d0f680b379
2 files changed
+22 -13

No files matched your search

+22 -11
View File
@@ -1253,7 +1253,7 @@ opcodes = [
stack_before=[],
stack_after=[pyint],
proto=2,
doc="""Long integer using found-byte length.
doc="""Long integer using four-byte length.
A more efficient encoding of a Python long; the long4 encoding
says it all."""),
@@ -2848,10 +2848,10 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='disassemble one or more pickle files')
parser.add_argument(
'pickle_file', type=argparse.FileType('br'),
'pickle_file',
nargs='*', help='the pickle file')
parser.add_argument(
'-o', '--output', default=sys.stdout, type=argparse.FileType('w'),
'-o', '--output',
help='the file where the output should be written')
parser.add_argument(
'-m', '--memo', action='store_true',
@@ -2876,15 +2876,26 @@ if __name__ == "__main__":
if args.test:
_test()
else:
annotate = 30 if args.annotate else 0
if not args.pickle_file:
parser.print_help()
elif len(args.pickle_file) == 1:
dis(args.pickle_file[0], args.output, None,
args.indentlevel, annotate)
else:
annotate = 30 if args.annotate else 0
memo = {} if args.memo else None
for f in args.pickle_file:
preamble = args.preamble.format(name=f.name)
args.output.write(preamble + '\n')
dis(f, args.output, memo, args.indentlevel, annotate)
if args.output is None:
output = sys.stdout
else:
output = open(args.output, 'w')
try:
for arg in args.pickle_file:
if len(args.pickle_file) > 1:
name = '<stdin>' if arg == '-' else arg
preamble = args.preamble.format(name=name)
output.write(preamble + '\n')
if arg == '-':
dis(sys.stdin.buffer, output, memo, args.indentlevel, annotate)
else:
with open(arg, 'rb') as f:
dis(f, output, memo, args.indentlevel, annotate)
finally:
if output is not sys.stdout:
output.close()
-2
View File
@@ -65,8 +65,6 @@ class OptimizedPickleTests(AbstractPickleTests, unittest.TestCase):
# Test relies on writing by chunks into a file object.
test_framed_write_sizes_with_delayed_writer = None
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_optimize_long_binget(self):
data = [str(i) for i in range(257)]
data.append(data[-1])