Clearing globals in CPython
ckaynor at zindagigames.com
Wed Oct 1 19:08:34 CEST 2014
On Wed, Oct 1, 2014 at 9:14 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, Oct 2, 2014 at 2:00 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> 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.
I've played with it a bit, and I haven't found any way to break it yet.
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.
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).
Note that I've been playing with Python 3.4.1.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list