diff --git a/client/ledis-py/ledis/client.py b/client/ledis-py/ledis/client.py index cffac29..034f2e3 100644 --- a/client/ledis-py/ledis/client.py +++ b/client/ledis-py/ledis/client.py @@ -906,11 +906,15 @@ class Ledis(object): return self.execute_command("BSCAN", key, match, count) def eval(self, script, keys, *args): - return self.execute_command('EVAL', script, len(keys), *keys, *args) + n = len(keys) + args = list_or_args(keys, args) + return self.execute_command('EVAL', script, n, *args) def evalsha(self, sha1, keys, *args): - return self.execute_command('EVALSHA', sha1, len(keys), *keys, *args) - + n = len(keys) + args = list_or_args(keys, args) + return self.execute_command('EVALSHA', sha1, n, *args) + def scriptload(self, script): return self.execute_command('SCRIPT', 'LOAD', script) diff --git a/client/ledis-py/tests/test_cmd_script.py b/client/ledis-py/tests/test_cmd_script.py index b2e2f18..02d7630 100644 --- a/client/ledis-py/tests/test_cmd_script.py +++ b/client/ledis-py/tests/test_cmd_script.py @@ -19,6 +19,7 @@ class TestCmdScript(unittest.TestCase): def tearDown(self): pass - + def testEval(self): + assert l.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", ["key1", "key2"], "first", "second") == ["key1", "key2", "first", "second"] \ No newline at end of file