diff options
author | Bas Westerbaan <bas@westerbaan.name> | 2014-06-14 18:34:17 +0200 |
---|---|---|
committer | Bas Westerbaan <bas@westerbaan.name> | 2014-06-14 18:34:17 +0200 |
commit | 952eb9fc5331fb7134cc70ce6084b30eff4ccda2 (patch) | |
tree | 6d3a605351c8e3738190a3403cb36a3a47b7c8cd /msgpack/fallback.py | |
parent | 7eb371f8278941fb2323e0c2333ed89c88ab822b (diff) | |
download | msgpack-python-952eb9fc5331fb7134cc70ce6084b30eff4ccda2.tar.gz |
fallback: add some comments to _fb_read
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r-- | msgpack/fallback.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py index d838e55..fbd87ba 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -252,11 +252,15 @@ class Unpacker(object): def _fb_read(self, n, write_bytes=None): buffs = self._fb_buffers + # We have a redundant codepath for the most common case, such that + # pypy optimizes it properly. This is the case that the read fits + # in the current buffer. if (write_bytes is None and self._fb_buf_i < len(buffs) and self._fb_buf_o + n < len(buffs[self._fb_buf_i])): self._fb_buf_o += n return buffs[self._fb_buf_i][self._fb_buf_o - n:self._fb_buf_o] + # The remaining cases. ret = b'' while len(ret) != n: if self._fb_buf_i == len(buffs): |