Hi python-list, 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. irb(main):001:0> require('rubypython') C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/blankslate-3.1.2/lib/blankslate.rb:51: warning: undefining `object_id' may cause serious problems => true irb(main):002:0> RubyPython.start => true irb(main):003:0> binmod = RubyPython.import('__builtin__') => <module '__builtin__' (built-in)> irb(main):004:0> binmod.execfile('foo.py') 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? Thank you, Rob
-- https://mail.python.org/mailman/listinfo/python-list