I'm embedding Python in an application and I have encountered two crashes while
calling built-in functions that expect a top-level frame. See the following bug
reports: http://bugs.python.org/issue21563 and
http://bugs.python.org/issue21418. The problem is that the workflow for
embedding the Python interpreter does not involve creation of a frame.
RubyPython, a language interface to call Python from Ruby, has the same
problem, http://rubypython.rubyforge.org/#known-problems. Since there is not a
top-level frame object, some built-in functions do not work properly. In most
cases, this problem is easily worked-around because globals and locals can be
passed as optional arguments. The crashes, however, are more unfortunate.
As an example, I can crash RubyPython by calling the built-in function execfile
with a single argument.
warning: undefining `object_id' may cause serious problems
irb(main):003:0> binmod = RubyPython.import('__builtin__')
=> <module '__builtin__' (built-in)>
The fourth line crashed the ruby interpreter. This is an example where an
application might want to give full access to the functions in a Python module.
It would be nice to find a way to prevent the crash without restricting the API.
I am curious if anyone has suggestions for creating a top-level frame?