summaryrefslogtreecommitdiff
path: root/redis
Commit message (Collapse)AuthorAgeFilesLines
...
* Tune the locking in ConnectionPool.get_connectionAndy McCurdy2020-05-141-21/+22
| | | | | The lock does not need to be held while waiting for the socket to establish and validate the TCP connection.
* 3.5.13.5.1Andy McCurdy2020-05-091-1/+1
|
* Fix for HSET argument validation to allow any non-None keyAleksMat2020-05-091-4/+4
| | | | | Fixes #1337 Fixes #1341
* version 3.5.03.5.0Andy McCurdy2020-04-291-1/+1
|
* Fix typo (missing space) in exception message (#1334)Jon Dufresne2020-04-281-1/+1
|
* Switch to flake8 for static code analysis (#1328)Jon Dufresne2020-04-164-3/+2
| | | | | | | | | flake8 catches a wider net of mistakes than pycodestyle and is more commonly used by the larger community. For example, it catches unused imports, a few of which existed. These have since been removed. Two "noqa" comments were added. One ignores the _compat.py file as it has a large amount of Python version specific code. The second is in utils.py which intentionally does not use an import.
* Enable BytesWarning during test and fix discovered case (#1322)Jon Dufresne2020-04-131-1/+5
| | | | | | | | | | | | The Python command line argument -b causes Python to emit a warning when bytes and str usage is mixed. This is generally considered bad practice as either one or the other is required. Enabling this feature during tests helps catch them before reaching production. The warning appeared as: tests/test_scripting.py::TestScripting::test_eval_msgpack_pipeline_error_in_lua .../redis-py/redis/client.py:3967: BytesWarning: str() on a bytes instance cmd = ' '.join(imap(safe_unicode, command))
* Fix str/bytes mixup in PythonParser.read_response() (#1324)Jon Dufresne2020-04-132-18/+11
| | | | | | | | | | | | Calling str() on a bytes object can result in a BytesWarning being emitted and usually indicates a mixup between byte and string handling. Now, in the event of an invalid RESP response, use the repr value of the raw response in the exception message. Can further simplify the bytes/str handling by comparing the first byte as a bytes object instead of converting it to str. The bytes literal is available on all supported Pythons. This removes the need for the compatibility function, byte_to_chr().
* Prefer Python 3 syntax in examples (#1325)Jon Dufresne2020-04-131-1/+1
| | | | As Python 3 is the future of the language, when the docs need to make a syntax choice, use the Python 3 version.
* Simplify exception handlers (#1319)Jon Dufresne2020-04-112-19/+15
| | | | | | | | | Use the "as" keyword to capture the exception in a variable instead of sys.exc_info(). Re-raise exception with the bare "raise" syntax. Avoid "# noqa: E722" by catching BaseException, which includes all exceptions including SystemExit.
* Fix typo: occured → occurred (#1315)Jon Dufresne2020-04-091-4/+4
|
* Lock.extend() can now replace the lock's existing TTL with a new valuelaixintao2020-03-241-14/+34
| | | | | | | Lock.extend() now has a new option, `replace_ttl`. When False (the default), Lock.extend() adds the `additional_time` to the lock's existing TTL. When replace_ttl=True, the lock's existing TTL is replaced with the value of `additional_time`.
* add keepttl option to set command.laixintao2020-03-121-1/+9
| | | | | fixes #1304 fixes #1280
* Clear pipeline watch state after execNick Gaya2020-03-101-0/+3
|
* Don't send DISCARD after ExecAbortError in pipelineNick Gaya2020-03-101-2/+0
| | | | | | | The `EXECABORT` error type was added in Redis 2.6.5 and is returned from an `EXEC` command to indicate that the transaction was aborted due to an invalid command. It is not necessary to call `DISCARD` after this error, and doing so causes a "DISCARD without MULTI" error.
* add support for the MEMORY STATS commandAndy McCurdy2020-02-251-3/+31
| | | | Fixes #1268
* Support memoryview encoding/decoding as a no-opCody-G2020-02-241-10/+15
| | | | | | | | | | This allows memoryview instances to be passed to Redis command args that expect strings or bytes. The memoryview instance is sent directly to the socket such that there are zero copies made of the underlying data during command packing. Fixes #1265 Fixes #1285
* Optimize sleeping while blocking for a lockColas Le Guernic2020-02-241-3/+2
| | | | | | | | | When waiting to acquire a lock, the Lock object will sleep until the lock is acquired or until blocking_timeout has elapsed. This optimization calculates whether the next iteration will occur after blocking_timeout has elapsed and short circuits it immediately. Fixes #1263
* expand AUTH fallback support to pre-v6 Redis servers.Andy McCurdy2020-02-121-0/+6
| | | | Ref #1274
* Stop hiding errors that occur inside __del__ methodsJon Dufresne2020-02-122-23/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an exception occurs inside the __del__ method, it should be reported to the developer. Not doing so could hide bugs. Python automatically handles exceptions inside __del__ methods, for example: class A: def __del__(self): 1 / 0 A() print("after del") Results in the output: $ python3 ~/blah.py Exception ignored in: <function A.__del__ at 0x7fbbf2bbfc20> Traceback (most recent call last): File "/home/jon/test.py", line 3, in __del__ 1 / 0 ZeroDivisionError: division by zero after del From this example, we can see the bug was not hidden and the code after __del__ still executed. fixes #1281
* Drop unused variables and imports (#1284)Jon Dufresne2020-02-121-1/+1
|
* Improve Redis.hmset() warning messageJon Dufresne2020-02-121-1/+6
| | | | | | | | | It now describe what is deprecated and displays for the callers line by using stacklevel=2. The warning is now tested and not emitted during normal test runs. Fixes #1282
* Make hset support multiple field/value pairs. (#1271)赖信涛2020-02-071-4/+16
| | | | | | | | | | | | * make `hset` command support multi field/value pairs. see: https://redis.io/commands/hset close https://github.com/andymccurdy/redis-py/issues/1269 deprecated: hmset Co-authored-by: Alan Mai <0110amai@gmail.com>
* 3.4.13.4.1Andy McCurdy2020-02-011-1/+1
|
* remove Redis and ConnectionPool __eq__ comparisonAndy McCurdy2020-02-012-12/+0
| | | | | | | | | | | | | After further thought this was a bad idea. Just because two connection pools share the same connection arguments does not make them equal. It would seem quite odd if pool_a == pool_b yet pool_a.disconnect() doesn't close all of pool_b's connections. Ref #1240 Fixes #1277 Fixes #1275 Fixes #1267 Fixes #1273
* Move the username argument in the Redis and Connection classes to the endAndy McCurdy2020-01-312-8/+7
| | | | | | | This helps those poor souls that specify all their connection options as non-keyword arguments. Fixes #1276
* Provide AUTH fallback support for connection URLs with a username componentAndy McCurdy2020-01-313-1/+25
| | | | | | | | | | | | | Prior to ACL support, redis-py ignored the username component of Connection URLs. With ACL support, usernames are no longer ignored and are used to authenticate against an ACL rule. Some cloud vendors with managed Redis instances (like Heroku) provide connection URLs with a username component pre-ACL that is not intended to be used. Sending that username to Redis servers < 6.0.0 results in an error. Attempt to detect this condition and retry the AUTH command with only the password such that authentication continues to work for these users. Fixes #1274
* 3.4.03.4.0Andy McCurdy2020-01-301-1/+1
|
* better thread-safety for ConnectionPool (#1270)Andy McCurdy2020-01-303-48/+146
| | | Better thread and fork safety for ConnectionPool and BlockingConnectionPool
* Fix spelling in docstring (#1272)Damon Jablons2020-01-301-1/+1
|
* add type filter to scan functionnetocp2020-01-301-5/+20
| | | | Fixed #1220
* Slight optimization to command packing.Andy McCurdy2019-12-291-3/+4
| | | | Fixed #1255
* Added the 'ssl_check_hostname' option.Andy McCurdy2019-12-292-2/+7
| | | | | | | | 'ssl_check_hostname' tells SSL Connections to whether to require the TCP hostname to match the hostname specified in the SSL Cert. By default 'ssl_check_hostname' is False to maintain backwards compatibility. Fixed #1196
* more accurate description of acceptable argument typesAndy McCurdy2019-12-291-2/+2
| | | | fixes #1214
* Allow setting client_name during connection construction.Peter van Dijk2019-12-292-16/+33
| | | | | | Client instances and Connection pools now accept "client_name" as an optional argument. If supplied, all connections created will be named via CLIENT SETNAME once the connection to the server is established.
* 'with' statement for PubSub (#765)Dmitry Kuragin2019-12-291-0/+6
| | | PubSub objects are now context managers.
* Testing the boolean nature of Pipeline instance should always return True.Andy McCurdy2019-12-291-0/+8
| | | | | | | | Prior to this, pipeline instances used __len__() which returns the number of queued commands on the pipeline. When there were no queued commands, the pipeline instance would evaluate to 0 or False. Fixes #994
* Added support for ACL commandsAndy McCurdy2019-12-283-18/+276
|
* Fix simple typo: recurrsion -> recursionTim Gates2019-12-071-1/+1
| | | | Closes #1252
* Fix TypeError by passing optional decode_responses keyword argument d… (#1239)Jakob Keller2019-11-111-2/+5
| | | | * Fix TypeError by passing optional decode_responses keyword argument down to parse_slowlog_get()
* Add equality test on Redis client and conn pool (#1240)Rajiv Bakulesh Shah2019-11-112-0/+12
| | | Add equality test on Redis client and connection pool
* Fix misplaced space (#1237)Thomas Matecki2019-10-271-1/+1
| | | Sorry, I'm a pendant.
* Allow Pipeline.execute() to execute on empty command stack if it is watching ↵Brian Maissy2019-10-241-1/+1
| | | | keys
* Version 3.3.113.3.11Andy McCurdy2019-10-132-2/+3
| | | | | | check exception.args rather than exception.message. exception.message was deprecated prior to Python 2.7 and some alternative builds have removed it completely.
* Version 3.3.103.3.10Zac Bristow2019-10-102-2/+2
| | | | | | | | | Fix SSL regression introduced in 3.3.9 The wrapper introduced to handle SSL timeout errors in Python 2.7 incorrectly assumed that instances of SSLError would always have a string as their first element. The safer approach is to check the message attribute on the error.
* Version 3.3.93.3.9Zac Bristow2019-10-103-6/+58
| | | | | | | | | Fixes SSL read timeouts in Python 2.7 The ssl module in Python 2.7 raises timeouts as ssl.SSLError instead of socket.timeout. When these timeouts are encountered, the error will be re-raised as socket.timeout so it is handled appropriately by the connection.
* version 3.3.8, fix MONITOR output to account for all types of clients3.3.8huangwei-ds52019-08-192-3/+17
| | | | | | | | | | The client section of MONITOR output varies for TCP connections, unix socket connections and commands executed from Lua scripts. Account for each of these cases by including an additional key `client_type` in the MONITOR output. `client_type` will be one of ('tcp', 'unix', 'lua'). `client_address` and `client_port` vary based on the `client_type`. Fixes #1201
* version 3.3.7, Fixed a socket.error regression introduced in 3.3.03.3.7Andy McCurdy2019-08-132-5/+17
| | | | | | | Prior versions of 3.3.x could potentially raise a raw socket.error (or one of its subclasses) instead of a redis.exceptions.ConnectionError. Fixes #1202
* version 3.3.6, fixed a regression in 3.3.5 with pubsub timeouts3.3.6Andy McCurdy2019-08-062-1/+9
| | | | Fixes #1200
* version 3.3.5, handle socket.timeout errors correctly in Python 2.73.3.5Andy McCurdy2019-08-022-17/+9
| | | | | Fix an issue where socket.timeout errors could be handled by the wrong exception handler in Python 2.7.