Clearing globals in CPython

Chris Angelico rosuav at
Wed Oct 1 18:14:03 CEST 2014

On Thu, Oct 2, 2014 at 2:00 AM, Steven D'Aprano
<steve+comp.lang.python at> wrote:
> Obviously the easiest way to recover is to exit the current session and
> restart it, but as a challenge, can we recover from this state?

Oooh interesting. This is kinda like breaking out of a sandbox, and I
know there are people here who are experts at that. However... I'm not
entirely sure how to get a backtrace, when you don't have any built-in
exceptions! In Python 2, I can define an old-style class and raise
that. However, with the removal of __builtins__, Python throws a bunch
of errors about restricted mode, so I'm really not sure where to go
from there.


More information about the Python-list mailing list