File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1+ * asyncio: Fix memory leak caused by hiredis (#2693)
12 * Allow data to drain from async PythonParser when reading during a disconnect()
23 * Use asyncio.timeout() instead of async_timeout.timeout() for python >= 3.11 (#2602)
34 * Add test and fix async HiredisParser when reading during a disconnect() (#2349)
Original file line number Diff line number Diff line change @@ -187,12 +187,13 @@ def __del__(self):
187187 except Exception :
188188 pass
189189
190- def parse_error (self , response : str ) -> ResponseError :
190+ @classmethod
191+ def parse_error (cls , response : str ) -> ResponseError :
191192 """Parse an error response"""
192193 error_code = response .split (" " )[0 ]
193- if error_code in self .EXCEPTION_CLASSES :
194+ if error_code in cls .EXCEPTION_CLASSES :
194195 response = response [len (error_code ) + 1 :]
195- exception_class = self .EXCEPTION_CLASSES [error_code ]
196+ exception_class = cls .EXCEPTION_CLASSES [error_code ]
196197 if isinstance (exception_class , dict ):
197198 exception_class = exception_class .get (response , ResponseError )
198199 return exception_class (response )
Original file line number Diff line number Diff line change @@ -158,12 +158,13 @@ class BaseParser:
158158 "NOPERM" : NoPermissionError ,
159159 }
160160
161- def parse_error (self , response ):
161+ @classmethod
162+ def parse_error (cls , response ):
162163 "Parse an error response"
163164 error_code = response .split (" " )[0 ]
164- if error_code in self .EXCEPTION_CLASSES :
165+ if error_code in cls .EXCEPTION_CLASSES :
165166 response = response [len (error_code ) + 1 :]
166- exception_class = self .EXCEPTION_CLASSES [error_code ]
167+ exception_class = cls .EXCEPTION_CLASSES [error_code ]
167168 if isinstance (exception_class , dict ):
168169 exception_class = exception_class .get (response , ResponseError )
169170 return exception_class (response )
You can’t perform that action at this time.
0 commit comments