(self)
| 790 | self._read_from_buffer(pos) |
| 791 | |
| 792 | def _start_read(self) -> Future: |
| 793 | if self._read_future is not None: |
| 794 | # It is an error to start a read while a prior read is unresolved. |
| 795 | # However, if the prior read is unresolved because the stream was |
| 796 | # closed without satisfying it, it's better to raise |
| 797 | # StreamClosedError instead of AssertionError. In particular, this |
| 798 | # situation occurs in harmless situations in http1connection.py and |
| 799 | # an AssertionError would be logged noisily. |
| 800 | # |
| 801 | # On the other hand, it is legal to start a new read while the |
| 802 | # stream is closed, in case the read can be satisfied from the |
| 803 | # read buffer. So we only want to check the closed status of the |
| 804 | # stream if we need to decide what kind of error to raise for |
| 805 | # "already reading". |
| 806 | # |
| 807 | # These conditions have proven difficult to test; we have no |
| 808 | # unittests that reliably verify this behavior so be careful |
| 809 | # when making changes here. See #2651 and #2719. |
| 810 | self._check_closed() |
| 811 | assert self._read_future is None, "Already reading" |
| 812 | self._read_future = Future() |
| 813 | return self._read_future |
| 814 | |
| 815 | def _finish_read(self, size: int) -> None: |
| 816 | if self._user_read_buffer: |
no test coverage detected