Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'importing': 0.04; 'cpython': 0.05; 'pypy': 0.07; 'python': 0.09; 'modules.': 0.09; 'other,': 0.09; 'preserve': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:modules': 0.09; '"python': 0.16; 'cons': 0.16; 'loud': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reimport': 0.16; 'reload': 0.16; 'threads': 0.16; 'wrote:': 0.17; 'mechanism': 0.17; 'code,': 0.18; 'load': 0.19; 'discussion': 0.20; 'question.': 0.20; 'written': 0.20; 'trying': 0.21; 'import': 0.21; "i've": 0.23; 'allows': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'thanks!': 0.26; 'prevent': 0.27; 'wonder': 0.27; 'execution': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'rest': 0.28; 'dan': 0.29; 'once,': 0.29; 'way?': 0.29; 'skip:_ 10': 0.29; "i'm": 0.29; "we're": 0.30; 'code': 0.31; 'url:python': 0.32; 'from:addr:yahoo.co.uk': 0.32; "aren't": 0.33; 'to:addr:python-list': 0.33; 'changed': 0.34; 'subject:?': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'ability': 0.36; 'but': 0.36; 'url:org': 0.36; 'modules': 0.36; 'url:library': 0.36; "i'll": 0.36; 'does': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'easier': 0.38; 'some': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'step': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'think': 0.40; 'your': 0.60; 'subject:, ': 0.61; 'kind': 0.61; 'world': 0.63; 'love': 0.63; 'here': 0.65; 'talking': 0.66; 'teaching': 0.66; 'friendly': 0.71; 'ins': 0.84; 'issues:': 0.84; 'malicious': 0.84; 'python- dev': 0.84; 'tie': 0.84; 'url:functions': 0.84; 'careful': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Reimporting modules, and sandboxing? Date: Wed, 22 Aug 2012 09:13:30 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-146-10-212.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: X-Antivirus: avast! (VPS 120821-0, 21/08/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345623177 news.xs4all.nl 6979 [2001:888:2000:d::a6]:40859 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27617 On 21/08/2012 22:51, Dan Stromberg wrote: > I know I've seen this discussed before, and I came away from observing the > discussion thinking "Python doesn't do that very well...", but we have some > people here who really would like to do this, and I need to better > understand the pros and cons now. > > Is there a good way of reimporting an _independent_ set of CPython modules? > > I'm aware of these issues: > http://stackoverflow.com/questions/1254370/reimport-a-module-in-python-while-interactive > http://docs.python.org/library/functions.html#reload > > Are there more? > > Does sandboxing Python code help in some way? If yes, then what kind of > sandbox? Note that this isn't sandboxing to prevent execution of malicious > code, it's sandboxing to preserve reimportability, which may be an easier > constraint to satisfy. The modules are friendly to each other, they aren't > trying to break into each other, we just have to be careful that they don't > step on each other's ability to reimport accidentally. > > Although I love Pypy, I don't think we'll be able to use Pypy sandboxes > this time around. > > Also, if we need to reload 3 modules at once, can reload() reimport them > atomically, as a set? Or would it need to do them one at a time? > > In short, we're talking about having some code that allows automatically > re-importing changed modules. These modules will be pretty independent of > each other in the Python world, but might interact with each other in the > REST world even though they're written in CPython. > > Thanks! > > > As there are no other replies, and my apologies if I'm teaching granny to suck eggs, but there are a load of threads on python-dev discussing sandboxing. Whether there are any tie ins with importing is for me not to know and for you to find out :) I'll also wonder out loud if the reworking of the import mechanism for 3.3 has any impact at all on your question. -- Cheers. Mark Lawrence.