Skip to content

Commit 5a4e3d8

Browse files
JelleZijlstraserhiy-storchaka
authored andcommitted
bpo-30174: Remove duplicate definition from pickletools (#1301)
There were two almost identical definitions of bytes1.
1 parent 5bccca5 commit 5a4e3d8

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

Lib/pickletools.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -469,35 +469,6 @@ def read_string4(f):
469469
""")
470470

471471

472-
def read_bytes1(f):
473-
r"""
474-
>>> import io
475-
>>> read_bytes1(io.BytesIO(b"\x00"))
476-
b''
477-
>>> read_bytes1(io.BytesIO(b"\x03abcdef"))
478-
b'abc'
479-
"""
480-
481-
n = read_uint1(f)
482-
assert n >= 0
483-
data = f.read(n)
484-
if len(data) == n:
485-
return data
486-
raise ValueError("expected %d bytes in a bytes1, but only %d remain" %
487-
(n, len(data)))
488-
489-
bytes1 = ArgumentDescriptor(
490-
name="bytes1",
491-
n=TAKEN_FROM_ARGUMENT1,
492-
reader=read_bytes1,
493-
doc="""A counted bytes string.
494-
495-
The first argument is a 1-byte unsigned int giving the number
496-
of bytes in the string, and the second argument is that many
497-
bytes.
498-
""")
499-
500-
501472
def read_bytes1(f):
502473
r"""
503474
>>> import io

0 commit comments

Comments
 (0)