diff options
author | Ben Greenberg <bgreenberg@eventbrite.com> | 2017-06-16 16:09:48 -0700 |
---|---|---|
committer | Ben Greenberg <bgreenberg@eventbrite.com> | 2017-06-16 16:09:48 -0700 |
commit | f79d321e6eeaf20682f44a98a54f11c98bfd07de (patch) | |
tree | a0e04bd7abc257c74b34b56fa0bfefd57559cd5b /redis/client.py | |
parent | b4260471eb5bbf67dbaf39b0f505ddb73e68102c (diff) | |
download | redis-py-f79d321e6eeaf20682f44a98a54f11c98bfd07de.tar.gz |
make register_scripts use the single string form of the SCRIPT (EXISTS|LOAD) commands so that they will be parsed the same way as in script_load and script_exists
Diffstat (limited to 'redis/client.py')
-rwxr-xr-x | redis/client.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/redis/client.py b/redis/client.py index bee539a..f5434dc 100755 --- a/redis/client.py +++ b/redis/client.py @@ -2849,12 +2849,11 @@ class BasePipeline(object): shas = [s.sha for s in scripts] # we can't use the normal script_* methods because they would just # get buffered in the pipeline. - exists = immediate('SCRIPT', 'EXISTS', *shas, **{'parse': 'EXISTS'}) + exists = immediate('SCRIPT EXISTS', *shas) if not all(exists): for s, exist in izip(scripts, exists): if not exist: - s.sha = immediate('SCRIPT', 'LOAD', s.script, - **{'parse': 'LOAD'}) + s.sha = immediate('SCRIPT LOAD', s.script) def execute(self, raise_on_error=True): "Execute all the commands in the current pipeline" @@ -2924,9 +2923,7 @@ class Script(object): self.registered_client = registered_client self.script = script # Precalculate and store the SHA1 hex digest of the script. - # Encode the digest because it should match the return type of script_load, which - # in Python 3 is bytes. - self.sha = hashlib.sha1(script.encode('utf-8')).hexdigest().encode('utf-8') + self.sha = hashlib.sha1(b(script)).hexdigest() def __call__(self, keys=[], args=[], client=None): "Execute the script, passing any required ``args``" |