(
weak_self: weakref.ReferenceType[HTTPResponse],
)
| 135 | super_update_chunk_length = response.__class__._update_chunk_length |
| 136 | |
| 137 | def _update_chunk_length( |
| 138 | weak_self: weakref.ReferenceType[HTTPResponse], |
| 139 | ) -> None: |
| 140 | self = weak_self() |
| 141 | if self is None: |
| 142 | return |
| 143 | |
| 144 | super_update_chunk_length(self) |
| 145 | if self.chunk_left == 0: |
| 146 | self._fp._close() # type: ignore[union-attr] |
| 147 | |
| 148 | response._update_chunk_length = functools.partial( # type: ignore[method-assign] |
| 149 | _update_chunk_length, weakref.ref(response) |