bpo-30174: Remove duplicate definition from pickletools (#1301)

There were two almost identical definitions of bytes1.
This commit is contained in:
Jelle Zijlstra 2017-04-27 09:05:26 -07:00 committed by Serhiy Storchaka
parent 5bccca58b9
commit 5a4e3d8f9c
1 changed files with 0 additions and 29 deletions

View File

@ -469,35 +469,6 @@ string4 = ArgumentDescriptor(
""") """)
def read_bytes1(f):
r"""
>>> import io
>>> read_bytes1(io.BytesIO(b"\x00"))
b''
>>> read_bytes1(io.BytesIO(b"\x03abcdef"))
b'abc'
"""
n = read_uint1(f)
assert n >= 0
data = f.read(n)
if len(data) == n:
return data
raise ValueError("expected %d bytes in a bytes1, but only %d remain" %
(n, len(data)))
bytes1 = ArgumentDescriptor(
name="bytes1",
n=TAKEN_FROM_ARGUMENT1,
reader=read_bytes1,
doc="""A counted bytes string.
The first argument is a 1-byte unsigned int giving the number
of bytes in the string, and the second argument is that many
bytes.
""")
def read_bytes1(f): def read_bytes1(f):
r""" r"""
>>> import io >>> import io