Skip to content

Commit

Permalink
Apply Lua.org patch
Browse files Browse the repository at this point in the history
Dead keys with nil values can stay in weak tables.

reported by 云风 Cloud Wu on 15 Aug 2017. existed since 5.2.

Example:
    See https://www.lua.org/bugs.html#5.3.4-5.
  • Loading branch information
Vultraz committed Oct 10, 2017
1 parent 8a5b0d3 commit 3347bd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lua/lgc.cpp
Expand Up @@ -643,8 +643,9 @@ static void clearkeys (global_State *g, GCObject *l, GCObject *f) {
for (n = gnode(h, 0); n < limit; n++) {
if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) {
setnilvalue(gval(n)); /* remove value ... */
removeentry(n); /* and remove entry from table */
}
if (ttisnil(gval(n))) /* is entry empty? */
removeentry(n); /* remove entry from table */
}
}
}
Expand Down

0 comments on commit 3347bd0

Please sign in to comment.