Clearing globals in CPython
Chris Kaynor
ckaynor at zindagigames.com
Wed Oct 1 13:08:34 EDT 2014
More information about the Python-list mailing list
Wed Oct 1 13:08:34 EDT 2014
- Previous message (by thread): Clearing globals in CPython
- Next message (by thread): Clearing globals in CPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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... URL: <http://mail.python.org/pipermail/python-list/attachments/20141001/df6b8f44/attachment.html>
- Previous message (by thread): Clearing globals in CPython
- Next message (by thread): Clearing globals in CPython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list