1 --- src/luainpython.c.orig 2011-07-26 12:49:51.456988438 +0600
2 +++ src/luainpython.c 2011-07-26 12:52:50.218038281 +0600
4 static PyObject *LuaObject_getattr(PyObject *obj, PyObject *attr)
9 lua_rawgeti(L, LUA_REGISTRYINDEX, ((LuaObject*)obj)->ref);
10 - if (lua_isnil(L, -1)) {
11 + type = lua_type(L, -1);
13 + if (type == LUA_TNIL) {
15 PyErr_SetString(PyExc_RuntimeError, "lost reference");
17 + /* It ought to be impossible to index a LUA_TNUMBER, LUA_TSTRING (and
18 + maybe others) as they should have already been converted to their
19 + Python equivalent. */
20 + } else if (type == LUA_TFUNCTION ||
21 + type == LUA_TLIGHTUSERDATA ||
22 + type == LUA_TTHREAD) {
24 + PyErr_Format(PyExc_RuntimeError, "cannot index values of type '%s'", lua_typename(L, type));
27 rc = py_convert(L, attr, 0);