Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78559

Re: Clearing globals in CPython

References <542c2527$0$13013$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmrcu+RK2KVDMy_FyQ=ovtks_eo=+Y4rOYUfM3E4uBLqfQ@mail.gmail.com>
From Chris Kaynor <ckaynor@zindagigames.com>
Date 2014-10-01 10:08 -0700
Subject Re: Clearing globals in CPython
Newsgroups comp.lang.python
Message-ID <mailman.14525.1412183342.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Oct 1, 2014 at 9:14 AM, Chris Angelico <rosuav@gmail.com> wrote:

> On Thu, Oct 2, 2014 at 2:00 AM, Steven D'Aprano
> <steve+comp.lang.python@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.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Clearing globals in CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-02 02:00 +1000
  Re: Clearing globals in CPython Chris Angelico <rosuav@gmail.com> - 2014-10-02 02:14 +1000
  Re: Clearing globals in CPython Chris Kaynor <ckaynor@zindagigames.com> - 2014-10-01 10:08 -0700
  Re: Clearing globals in CPython Peter Otten <__peter__@web.de> - 2014-10-01 19:24 +0200
    Re: Clearing globals in CPython Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-02 18:11 +1000
      Re: Clearing globals in CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-02 09:30 +0100
    Re: Clearing globals in CPython jakubo <jakubo@example.org> - 2014-10-06 09:05 +0000
      Re: Clearing globals in CPython Steven D'Aprano <steve@pearwood.info> - 2014-10-06 09:08 +0000
        Re: Clearing globals in CPython Chris Angelico <rosuav@gmail.com> - 2014-10-06 20:30 +1100
  Re: Clearing globals in CPython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-01 19:17 +0100
  Re: Clearing globals in CPython Terry Reedy <tjreedy@udel.edu> - 2014-10-01 14:44 -0400
  Re: Clearing globals in CPython Marco Buttu <marco.buttu@gmail.com> - 2014-10-01 18:39 +0200
  Re: Clearing globals in CPython Grant Edwards <invalid@invalid.invalid> - 2014-10-02 14:07 +0000
    Re: Clearing globals in CPython Chris Angelico <rosuav@gmail.com> - 2014-10-03 00:12 +1000
    Re: Clearing globals in CPython Stefan Behnel <stefan_ml@behnel.de> - 2014-10-03 07:26 +0200

csiph-web