pandoc-lua-marshal 0.1.3 → 0.1.3.1
raw patch · 4 files changed
+19/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−1
- cbits/listmod.c +3/−0
- pandoc-lua-marshal.cabal +1/−1
- test/test-list.lua +7/−0
CHANGELOG.md view
@@ -2,9 +2,16 @@ `pandoc-lua-marshal` uses [PVP Versioning][]. +## 0.1.3.1++Released 2022-01-14.++- Fixed a bug in `List.include` that was causing the Lua stack+ to overflow when the function was applied to long lists.+ ## 0.1.3 -Release pending.+Released 2021-12-23. ### Lua changes
cbits/listmod.c view
@@ -172,6 +172,7 @@ ** element's index, or `nil` if no such element exists. */ static int list_find (lua_State *L) {+ luaL_checkstack(L, 2, "List.find"); lua_settop(L, 3); luaL_checktype(L, 1, LUA_TTABLE); lua_Integer len = luaL_len(L, 1);@@ -182,6 +183,7 @@ lua_pushinteger(L, i); return 2; }+ lua_pop(L, 1); /* remove list element result */ } lua_pushnil(L); return 1;@@ -223,6 +225,7 @@ lua_pushcfunction(L, list_find); lua_insert(L, 1); lua_call(L, 3, 1);+ luaL_checkstack(L, 1, "List.includes"); lua_pushboolean(L, lua_toboolean(L, -1)); return 1; }
pandoc-lua-marshal.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-lua-marshal-version: 0.1.3+version: 0.1.3.1 synopsis: Use pandoc types in Lua description: This package provides functions to marshal and unmarshal pandoc document types to and from Lua.
test/test-list.lua view
@@ -127,6 +127,13 @@ assert.is_truthy(lst:includes('two')) assert.is_truthy(lst:includes('three')) assert.is_falsy(lst:includes('four'))+ end),+ test('doesn\'t crash with long lists', function ()+ local lst = List:new()+ for i = 1, 1000 do+ lst[#lst + 1] = tostring(i)+ end+ assert.is_truthy(lst:includes '999') end) },