Handle cases when inspect.stack() fails
test inspect.stack failure
Merge pull request #582 from kmike/inspect-workaround

[WIP] Handle cases when inspect.stack() fails