Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; 'ok.': 0.04; 'subject:Error': 0.05; 'subject:when': 0.07; ':-(': 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; 'am,': 0.12; 'stored': 0.13; 'subject:file': 0.13; 'bytecode': 0.16; 'loaded,': 0.16; 'needed?': 0.16; 'one-': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'sajip': 0.16; 'vinay': 0.16; "wouldn't": 0.17; 'url:bugs': 0.17; 'wrote:': 0.18; 'loading': 0.18; 'from:addr:web.de': 0.23; 'cache': 0.24; 'fix': 0.25; 'expect': 0.25; 'loaded': 0.25; 'resolution': 0.26; 'module': 0.26; 'load': 0.26; 'explicitly': 0.29; 'module.': 0.29; 'ram': 0.29; 'context,': 0.30; 'hours,': 0.30; 'over.': 0.30; '(as': 0.31; 'tue,': 0.32; 'header:User-Agent:1': 0.33; 'object': 0.33; 'file': 0.34; 'header:X-Complaints-To:1': 0.34; 'all.': 0.34; 'probably': 0.35; 'to:addr:python-list': 0.35; 'url:python': 0.35; 'received:org': 0.36; 'aspect': 0.37; 'run': 0.37; 'but': 0.37; 'subject:with': 0.37; 'could': 0.38; 'think': 0.38; 'files': 0.39; 'url:org': 0.39; 'unless': 0.39; 'subject:from': 0.39; 'hit': 0.40; 'to:addr:python.org': 0.40; 'quick': 0.61; 'kept': 0.68; 'darn': 0.84; 'impact.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Error with co_filename when loading modules from zip file Date: Tue, 06 Mar 2012 14:59:48 +0100 Organization: (None) References: <6c8fd85f-b489-450e-82a4-ee01b231a09f@n12g2000yqb.googlegroups.com> <20120306134131.GA14891@brasko> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p50849614.dip.t-dialin.net User-Agent: KNode/4.7.3 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331042409 news.xs4all.nl 6874 [2001:888:2000:d::a6]:51117 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21270 Bob Rossi wrote: > On Tue, Mar 06, 2012 at 02:38:50AM -0800, Vinay Sajip wrote: >> On Mar 6, 2:40 am, Bob Rossi wrote: >> >> > Darn it, this was reported in 2007 >> > http://bugs.python.org/issue1180193 >> > and it was mentioned the logging package was effected. >> > >> > Yikes. >> > >> >> I will think about this, but don't expect any quick resolution :-( I >> think the right fix would be not in the logging package, but in the >> module loading machinery (as mentioned on that issue). >> >> I wouldn't worry about the performance aspect - once the logging >> package is loaded, there's no performance impact. That's a tiny one- >> off hit which you will probably not notice at all. > > OK. > > Do you know where the bytecode gets stored when you load a py > file from a zip? > > My program can potentially run for hours, from an embedded context, > and could call into the logger and other py files over and over. > > Are the bytecode files stored in RAM one time, or recomputed each > time they are needed? The bytecode is generated once when the module is loaded and kept as part of the module object in the sys.modules cache unless you explicitly reload() the module. For a long-running program the compilation overhead is negligable.