File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,8 @@ async def can_read_destructive(self) -> bool:
247247 return False
248248
249249 async def read_response (self , disable_decoding : bool = False ):
250+ if self ._stream is None :
251+ raise RedisError ("Buffer is closed." )
250252 if self ._chunks :
251253 # augment parsing buffer with previously read data
252254 self ._buffer += b"" .join (self ._chunks )
@@ -325,8 +327,6 @@ async def _read(self, length: int) -> bytes:
325327 if len (self ._buffer ) >= end :
326328 result = self ._buffer [self ._pos : end - 2 ]
327329 else :
328- if self ._stream is None :
329- raise RedisError ("Buffer is closed." )
330330 tail = self ._buffer [self ._pos :]
331331 try :
332332 data = await self ._stream .readexactly (want - len (tail ))
@@ -346,8 +346,6 @@ async def _readline(self) -> bytes:
346346 if found >= 0 :
347347 result = self ._buffer [self ._pos : found ]
348348 else :
349- if self ._stream is None :
350- raise RedisError ("Buffer is closed." )
351349 tail = self ._buffer [self ._pos :]
352350 data = await self ._stream .readline ()
353351 if not data .endswith (b"\r \n " ):
You can’t perform that action at this time.
0 commit comments