aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-08-17 17:38:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-08-17 17:38:51 -0300
commit8a008a20579dd6818cb770147c8765b72eb2acfe (patch)
tree76b08f24056a2305417eac3ccb69926d53483ca8
parent89b59eee7386379e87200a86215fc6de91e49036 (diff)
downloadlua-8a008a20579dd6818cb770147c8765b72eb2acfe.tar.gz
lua-8a008a20579dd6818cb770147c8765b72eb2acfe.tar.bz2
lua-8a008a20579dd6818cb770147c8765b72eb2acfe.zip
bug: __newindex metamethod may not work if metatable is its own
metatable.
-rw-r--r--bugs31
1 files changed, 29 insertions, 2 deletions
diff --git a/bugs b/bugs
index 0f17c4be..ac31e8c3 100644
--- a/bugs
+++ b/bugs
@@ -1880,8 +1880,8 @@ patch = [[
1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4 1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4
1881@@ -1,5 +1,5 @@ 1881@@ -1,5 +1,5 @@
1882 /* 1882 /*
1883-** $Id: bugs,v 1.108 2010/05/14 15:34:57 roberto Exp roberto $ 1883-** $Id: bugs,v 1.109 2011/01/31 14:52:32 roberto Exp roberto $
1884+** $Id: bugs,v 1.108 2010/05/14 15:34:57 roberto Exp roberto $ 1884+** $Id: bugs,v 1.109 2011/01/31 14:52:32 roberto Exp roberto $
1885 ** load precompiled Lua chunks 1885 ** load precompiled Lua chunks
1886 ** See Copyright Notice in lua.h 1886 ** See Copyright Notice in lua.h
1887 */ 1887 */
@@ -2359,3 +2359,30 @@ patch = [[
2359 break; 2359 break;
2360]] 2360]]
2361} 2361}
2362
2363Bug{
2364what = [[__newindex metamethod may not work if metatable is its own
2365metatable]],
2366report = [[Cuero Bugot, 2011/08/09]],
2367since = [[5.1]],
2368example = [[
2369meta={}
2370setmetatable(meta, meta)
2371meta.__newindex = function(t, key, value) print("set") end
2372o = setmetatable({}, meta)
2373o.x = 10 -- should print 'set'
2374]],
2375patch = [[
2376--- lvm.c 2009/07/01 21:10:33 2.63.1.4
2377+++ lvm.c 2011/08/17 20:36:28
2378@@ -142,6 +142,7 @@
2379 if (!ttisnil(oldval) || /* result is no nil? */
2380 (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
2381 setobj2t(L, oldval, val);
2382+ h->flags = 0;
2383 luaC_barriert(L, h, val);
2384 return;
2385 }
2386]]
2387}
2388