Skip to content

Commit cf07d75

Browse files
Merge branch 'master' into kristjan/interrupt-2
2 parents 2fefdf2 + db9a85c commit cf07d75

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* Revert #2104, add `disconnect_on_error` option to `read_response()` (#2506)
2+
* asyncio: Fix memory leak caused by hiredis (#2693)
23
* Allow data to drain from async PythonParser when reading during a disconnect()
34
* Use asyncio.timeout() instead of async_timeout.timeout() for python >= 3.11 (#2602)
45
* Add test and fix async HiredisParser when reading during a disconnect() (#2349)

docs/redismodules.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ below, an index named *my_index* is being created. When an index name is not spe
119119
120120
r = redis.Redis()
121121
index_name = "my_index"
122-
r.ft(index_name).create_index(TextField("play", weight=5.0), TextField("ball"))
122+
schema = (
123+
TextField("play", weight=5.0),
124+
TextField("ball"),
125+
)
126+
r.ft(index_name).create_index(schema)
123127
print(r.ft(index_name).info())
124128
125129

redis/asyncio/connection.py

+4-3
Original file line numberDiff line numberDiff 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)

redis/connection.py

+4-3
Original file line numberDiff line numberDiff 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)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
install_requires=[
3535
'importlib-metadata >= 1.0; python_version < "3.8"',
3636
'typing-extensions; python_version<"3.8"',
37-
'async-timeout>=4.0.2; python_version<="3.11.2"',
37+
'async-timeout>=4.0.2; python_full_version<="3.11.2"',
3838
],
3939
classifiers=[
4040
"Development Status :: 5 - Production/Stable",

0 commit comments

Comments
 (0)