mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Merge pull request #1804 from mattsta/lua-regression-1118
Scripting: Fix regression from #1118
This commit is contained in:
commit
3ac1dad77a
@ -200,6 +200,11 @@ void luaSortArray(lua_State *lua) {
|
|||||||
lua_pop(lua,1); /* Stack: array (sorted) */
|
lua_pop(lua,1); /* Stack: array (sorted) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int luaReallyIsString(lua_State *L, int index) {
|
||||||
|
int t = lua_type(L, index);
|
||||||
|
return t == LUA_TSTRING;
|
||||||
|
}
|
||||||
|
|
||||||
#define LUA_CMD_OBJCACHE_SIZE 32
|
#define LUA_CMD_OBJCACHE_SIZE 32
|
||||||
#define LUA_CMD_OBJCACHE_MAX_LEN 64
|
#define LUA_CMD_OBJCACHE_MAX_LEN 64
|
||||||
int luaRedisGenericCommand(lua_State *lua, int raise_error) {
|
int luaRedisGenericCommand(lua_State *lua, int raise_error) {
|
||||||
@ -234,7 +239,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
|
|||||||
size_t obj_len;
|
size_t obj_len;
|
||||||
char dbuf[64];
|
char dbuf[64];
|
||||||
|
|
||||||
if (lua_isnumber(lua,j+1)) {
|
if (!luaReallyIsString(lua, j+1) && lua_isnumber(lua, j+1)) {
|
||||||
/* We can't use lua_tolstring() for number -> string conversion
|
/* We can't use lua_tolstring() for number -> string conversion
|
||||||
* since Lua uses a format specifier that loses precision. */
|
* since Lua uses a format specifier that loses precision. */
|
||||||
lua_Number num = lua_tonumber(lua,j+1);
|
lua_Number num = lua_tonumber(lua,j+1);
|
||||||
|
@ -347,6 +347,13 @@ start_server {tags {"scripting"}} {
|
|||||||
return redis.call("get","foo")
|
return redis.call("get","foo")
|
||||||
} 0
|
} 0
|
||||||
} {9007199254740991}
|
} {9007199254740991}
|
||||||
|
|
||||||
|
test {String containing number precision test (regression of issue #1118)} {
|
||||||
|
r eval {
|
||||||
|
redis.call("set", "key", "12039611435714932082")
|
||||||
|
return redis.call("get", "key")
|
||||||
|
} 0
|
||||||
|
} {12039611435714932082}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start a new server since the last test in this stanza will kill the
|
# Start a new server since the last test in this stanza will kill the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user