IronPython and Python Stack Frames

One incompatibility between IronPython and CPython that is unlikely to go away, is that IronPython does not have Python stack frames. IronPython is implemented on the CLR, which has its own stack frames that are very different to the Python ones.

This means that tricks with 'sys._getframe()' and friends will never work with IronPython.

JRuby, for Ruby compatibility, does use frames. Charles Nutter (one of the JRuby devs) has been experimenting with a frameless approach that yields faster execution:
(A paragraph near the bottom of that blog entry.) Python stack frames are seen as an implementation detail, and if you want your code to run across implementations then you shouldn't interact with them directly (does PyPy use Python stack frames?). Even though it is almost always a hack, we have missed them occasionally at Resolver. The notes from Charles sheds light on the IronPython design decision.

Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

Should Python Projects Support IronPython and Jython?

Further Adventures of the Debugger