<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 1, 2014 at 9:14 AM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Thu, Oct 2, 2014 at 2:00 AM, Steven D'Aprano<br>
<<a href="mailto:steve%2Bcomp.lang.python@pearwood.info">steve+comp.lang.python@pearwood.info</a>> wrote:<br>
> Obviously the easiest way to recover is to exit the current session and<br>
> restart it, but as a challenge, can we recover from this state?<br>
<br>
</span>Oooh interesting. This is kinda like breaking out of a sandbox, and I<br>
know there are people here who are experts at that. However... I'm not<br>
entirely sure how to get a backtrace, when you don't have any built-in<br>
exceptions! In Python 2, I can define an old-style class and raise<br>
that. However, with the removal of __builtins__, Python throws a bunch<br>
of errors about restricted mode, so I'm really not sure where to go<br>
from there.<br></blockquote><div><br></div><div>I've played with it a bit, and I haven't found any way to break it yet.</div><div><br></div><div>I have discovered that you cannot directly declare classes, although you can access the type built-in (indirectly) so it might be possible to indirectly declare a class.</div><div><br></div><div>It is also possible to access the types of many of the built-ins (str, bytes, dict, set, type, object, frame, function, code, generator, int, float at a minimum).</div><div><br></div><div>Note that I've been playing with Python 3.4.1.</div></div></div></div>