Mercurial > hg
comparison .clang-format @ 51899:e26a08563223
statichttprepo: fix `httprangereader.read()` for py3
It looks like there were a bunch of problems, not all of them py3 related:
1) The signature of BinaryIO.read() is -1, not None
2) The `end` variable can't be bytes and interpolate into str with "%s"
3) The `end` variable can't be an int and interpolate into str with "%s"
4) The result slicing could be out of bounds if more is requested than
returned
I guess if somebody would have called `read(-1)` (either directly or because a
wrapper defaults to that), it wouldn't have been handled correctly. The fact
that it is a valid value meaning to read everything requires some additional
changes later in the method around when it slices the byte string that was read,
but that seems to have already been broken.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 25 Sep 2024 01:12:39 -0400 |
parents | d0a3fa849cb8 |
children |
comparison
equal
deleted
inserted
replaced
51898:159854151f0f | 51899:e26a08563223 |
---|