I patched pyv8 to return v8 undefined instead of null in this case:
import PyV8
class Global():
def __init__(self):
self.g = self
def write(self, val):
print val
def __getitem__(self, val):
pass
context = PyV8.JSContext(Global())
with context as ctx:
ctx.eval("""x = g.z; write(typeof x === "undefined")""")
The relevant code is in Wrapper.cpp, CPythonObject::NamedGetter
if (::PyMapping_Check(obj.ptr()) && ::PyMapping_HasKeyString(obj.ptr(), *name))
{
py::object result(py::handle<>(::PyMapping_GetItemString(obj.ptr(), *name)));
if (result.ptr() == Py_None) {
// return undefined
return v8::Handle<v8::Value>();
}
return Wrap(result);
}
Original issue reported on code.google.com by ATM1...@gmail.com on 5 Apr 2011 at 7:21
Original issue reported on code.google.com by
ATM1...@gmail.com
on 5 Apr 2011 at 7:21