Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'exit': 0.09; 'restart': 0.09; 'throws': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'backtrace,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mode,': 0.16; 'old-style': 0.16; 'subject:Clearing': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'define': 0.26; 'header:In-Reply-To:1': 0.27; '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; 'restricted': 0.31; 'steven': 0.31; 'class': 0.32; 'there.': 0.32; 'entirely': 0.33; 'skip:_ 10': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'easiest': 0.38; 'sure': 0.39; 'how': 0.40; 'experts': 0.60; 'here': 0.66; 'removal': 0.74; 'recover': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=5KWApR+4mhwAS26TLVwId7nIwN5ys0FGLIgd4mMxAAM=; b=OX9BlZJlvbbkCOPTr3S5uD5Fc9c6IEtXPUKo4N2CJ21rfuY4ByeDMG1v1A4SC1GMtC 2yGJLIAAE3I8OMC5uQpTnlQdiI+UzO9jEm6puuFlA6P15VJ0CRBoXd277UGyt8FFKlE+ BK30XPSUIAGsDQnOC4iMY/tXN5E2XtdeSZJTkFz+vo4qCYafmgzbzRodaIAfjdqfysyZ e3+8fPOlkJ4ecnSW8pIALh15hjd7SB3IXPl/yMs9Qtdg8xpd2IfRa95ajuyBOm93Hjc+ kwht4qWH/w/4Retifh5sqZyv6fhE6dSJf7L9HpAjy2yluEp9A9X5SwuJ0/IiR3EkHSqC h8lg== MIME-Version: 1.0 X-Received: by 10.51.17.2 with SMTP id ga2mr21516825igd.2.1412180043890; Wed, 01 Oct 2014 09:14:03 -0700 (PDT) In-Reply-To: <542c2527$0$13013$c3e8da3$5496439d@news.astraweb.com> References: <542c2527$0$13013$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 2 Oct 2014 02:14:03 +1000 Subject: Re: Clearing globals in CPython From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412180046 news.xs4all.nl 2861 [2001:888:2000:d::a6]:44352 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78555 On Thu, Oct 2, 2014 at 2:00 AM, Steven D'Aprano 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. ChrisA