diff options
author | Oran Avraham <252748+oranav@users.noreply.github.com> | 2023-04-13 14:57:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 14:57:50 +0300 |
commit | 6a4240b205d7d63e1aa4803f8430248bebac071b (patch) | |
tree | 87411651772cc850a88433e241f878f21a9222e5 /redis/asyncio/connection.py | |
parent | 7ae8464798f4b3d2eda290c6f49ced14ef7e0029 (diff) | |
download | redis-py-6a4240b205d7d63e1aa4803f8430248bebac071b.tar.gz |
asyncio: Fix memory leak caused by hiredis (#2693) (#2694)
Diffstat (limited to 'redis/asyncio/connection.py')
-rw-r--r-- | redis/asyncio/connection.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 58dcd66..59f75aa 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -187,12 +187,13 @@ class BaseParser: except Exception: pass - def parse_error(self, response: str) -> ResponseError: + @classmethod + def parse_error(cls, response: str) -> ResponseError: """Parse an error response""" error_code = response.split(" ")[0] - if error_code in self.EXCEPTION_CLASSES: + if error_code in cls.EXCEPTION_CLASSES: response = response[len(error_code) + 1 :] - exception_class = self.EXCEPTION_CLASSES[error_code] + exception_class = cls.EXCEPTION_CLASSES[error_code] if isinstance(exception_class, dict): exception_class = exception_class.get(response, ResponseError) return exception_class(response) |