From: Jelle Zijlstra Date: Thu, 27 Apr 2017 16:05:26 +0000 (-0700) Subject: bpo-30174: Remove duplicate definition from pickletools (#1301) X-Git-Tag: v3.7.0a1~891 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a4e3d8f9c37e700402b23fafbfc413e5ca3113d;p=thirdparty%2FPython%2Fcpython.git bpo-30174: Remove duplicate definition from pickletools (#1301) There were two almost identical definitions of bytes1. --- diff --git a/Lib/pickletools.py b/Lib/pickletools.py index 5e129b5b5637..0c8dddc10bbc 100644 --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -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): r""" >>> import io