commit | 6a7f73bb9a55ab4463238af4c5096e6bf3789934 | [log] [tgz] |
---|---|---|
author | Daniel Kutik <daniel.kutik@lavawerk.com> | Mon Oct 09 13:21:25 2023 +0200 |
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Oct 09 17:04:38 2023 +0000 |
tree | 6c21d19062ffffc5e2918f6dbb0c6d246abf2b17 | |
parent | 23d063bdcd1bdcaa70ac8565615764dd4313adf9 [diff] |
git_command: read1 needs a size in py3.6 Not setting size causes "TypeError: read1() takes exactly one argument (0 given)" in Python 3.6. In Python 3.7 onwards size defaults to -1, which means an arbitrary number of bytes will be returned. Compare https://docs.python.org/3.6/library/io.html#io.BufferedReader.read1 and https://docs.python.org/3.7/library/io.html#io.BufferedIOBase.read1 for more details. Change-Id: Ia4aaf8140ead9493ec650fac167c641569e6a9d8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/388718 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com>
diff --git a/git_command.py b/git_command.py index 4b17f78..2e4974f 100644 --- a/git_command.py +++ b/git_command.py
@@ -503,7 +503,8 @@ A str containing everything read from the in_stream. """ buffer = "" - chunk = in_stream.read1() + read_size = 1024 if sys.version_info < (3, 7) else -1 + chunk = in_stream.read1(read_size) while chunk: # Convert to str. if not hasattr(chunk, "encode"): @@ -513,7 +514,7 @@ out_stream.write(chunk) out_stream.flush() - chunk = in_stream.read1() + chunk = in_stream.read1(read_size) return buffer