Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Iterate over ARGV or HGETALL results in Lua scripting #204

Closed
NimrodParasol opened this issue Aug 19, 2018 · 2 comments
Closed

Can't Iterate over ARGV or HGETALL results in Lua scripting #204

NimrodParasol opened this issue Aug 19, 2018 · 2 comments

Comments

@NimrodParasol
Copy link
Contributor

NimrodParasol commented Aug 19, 2018

When using eval to run Lua script, when iterating over ARGV using the following code:

for i, v in ipairs(ARGV) do
end

An exception is thrown:

/home/ubuntu/venv3/lib/python3.5/site-packages/fakeredis.py:2201: in execute
    for name, args, kwargs in self.commands]
/home/ubuntu/venv3/lib/python3.5/site-packages/fakeredis.py:2201: in <listcomp>
    for name, args, kwargs in self.commands]
/home/ubuntu/venv3/lib/python3.5/site-packages/fakeredis.py:221: in decode_response
    val = _decode(func(*args, **kwargs))
/home/ubuntu/venv3/lib/python3.5/site-packages/fakeredis.py:342: in func_wrapper
    return func(*args, **kwargs)
/home/ubuntu/venv3/lib/python3.5/site-packages/fakeredis.py:849: in eval
    result = lua_runtime.execute(script)
lupa/_lupa.pyx:277: in lupa._lupa.LuaRuntime.execute
    ???
lupa/_lupa.pyx:1294: in lupa._lupa.run_lua
    ???
lupa/_lupa.pyx:1303: in lupa._lupa.call_lua
    ???
lupa/_lupa.pyx:1328: in lupa._lupa.execute_lua_call
    ???
lupa/_lupa.pyx:250: in lupa._lupa.LuaRuntime.reraise_on_exception
    ???
lupa/_lupa.pyx:1571: in lupa._lupa.py_object_getindex_with_gil
    ???

   ???
E   IndexError: list index out of range

The code is working just fine against a real Redis.
Look like it happens due to ARGV being POBJECT (a Lupa's type?) instead of a regular Lua table.

The same happens when trying to iterate over the results of redis.call('HGETALL', key)

@NimrodParasol NimrodParasol changed the title Can't Iterate over ARGV in Lua scripting Can't Iterate over ARGV or HGETALL results in Lua scripting Aug 19, 2018
@bmerry
Copy link
Collaborator

bmerry commented Aug 19, 2018

Thanks for the report. I don't know much about Lua myself, so the only way this is likely to get fixed is if someone (such as yourself) can contribute a pull request.

@bmerry
Copy link
Collaborator

bmerry commented Aug 24, 2018

@NimrodParasol I'm assuming that this is fixed by #208 and #209. If not please re-open.

@bmerry bmerry closed this as completed Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants