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


Groups > comp.lang.python > #78559

Re: Clearing globals in CPython

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ckaynor@zindagigames.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; 'classes,': 0.05; 'float': 0.07; 'bytes,': 0.09; 'exit': 0.09; 'function,': 0.09; 'restart': 0.09; 'throws': 0.09; 'type,': 0.09; 'python': 0.11; 'backtrace,': 0.16; 'frame,': 0.16; 'indirectly': 0.16; 'mode,': 0.16; 'old-style': 0.16; 'set,': 0.16; 'subject:Clearing': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'code,': 0.22; 'email addr:gmail.com&gt;': 0.22; 'to:name:python-list@python.org': 0.22; "haven't": 0.24; "i've": 0.25; '&gt;': 0.26; 'class.': 0.26; 'define': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'raise': 0.29; 'errors': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; 'breaking': 0.31; 'bunch': 0.31; "d'aprano": 0.31; 'int,': 0.31; 'restricted': 0.31; 'steven': 0.31; 'class': 0.32; 'there.': 0.32; 'received:209.85.212': 0.32; 'entirely': 0.33; 'skip:_ 10': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'object,': 0.36; 'possible': 0.36; 'received:209': 0.37; 'easiest': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'experts': 0.60; 'break': 0.61; 'here': 0.66; 'removal': 0.74; 'discovered': 0.83; 'dict,': 0.84; 'played': 0.84; 'recover': 0.91
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=JpGfqqgR5eLKddtXP4IeBlibYBhEEhzGNayoqHTxO1k=; b=FoudN9mPzTYwo+h59Tq/4hrwcqZ+NNnrlq1/xABImS8VZJye42ADpQBr2k9V3WfHSv /t1cKgqIFeCSs+9yVDo3JmEfLgu/AtKbm5hAYqq2/QnTvcJopmmRmmp3cpVuW1m3BBTl ICBryMi/bpMkDuRG48DxjzhYxtogLUsE3c7C0uKfOUa70GJR8CfLDPadH5PdlSi6tKtI B4mi22uyCDY6ObMZ4PHu5EUZ40GJ+fPc1RVIQvt3I1QlgTMycCFYLqyDp+AQT5wxVqJA p0Ki8hNQWofWTlE7TrmxAGk9vWyzd/+mhiJUEi7FJP9krAANIPxwgYd6vFwlpSt4jlHy qr4g==
X-Gm-Message-State ALoCoQl4X51SAAqeBRpFnuvRDO2mCQDRScpb82Dol0S601iJYwSz4alK0x7PtUCmvpsfV++TtKlf
X-Received by 10.180.95.35 with SMTP id dh3mr15984084wib.24.1412183334078; Wed, 01 Oct 2014 10:08:54 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmrcu+RK2KVDMy_FyQ=ovtks_eo=+Y4rOYUfM3E4uBLqfQ@mail.gmail.com>
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 Wed, 1 Oct 2014 10:08:34 -0700
Subject Re: Clearing globals in CPython
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=f46d04447e1dfc66c605045f8d4d
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14525.1412183342.18130.python-list@python.org> (permalink)
Lines 68
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412183342 news.xs4all.nl 2885 [2001:888:2000:d::a6]:40167
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78559

Show key headers only | 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