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


Groups > comp.lang.python > #21270

Re: Error with co_filename when loading modules from zip file

From Peter Otten <__peter__@web.de>
Subject Re: Error with co_filename when loading modules from zip file
Date 2012-03-06 14:59 +0100
Organization (None)
References <mailman.410.1330979936.3037.python-list@python.org> <c1e15a96-3e77-4d7e-b684-d1b8a2bd49b1@p13g2000yqd.googlegroups.com> <mailman.418.1331001742.3037.python-list@python.org> <6c8fd85f-b489-450e-82a4-ee01b231a09f@n12g2000yqb.googlegroups.com> <20120306134131.GA14891@brasko>
Newsgroups comp.lang.python
Message-ID <mailman.425.1331042409.3037.python-list@python.org> (permalink)

Show all headers | View raw


Bob Rossi wrote:

> On Tue, Mar 06, 2012 at 02:38:50AM -0800, Vinay Sajip wrote:
>> On Mar 6, 2:40 am, Bob Rossi <b...@brasko.net> 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.

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


Thread

Error with co_filename when loading modules from zip file Bob <bob@brasko.net> - 2012-03-05 15:36 -0500
  Re: Error with co_filename when loading modules from zip file Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-03-05 14:22 -0800
    Re: Error with co_filename when loading modules from zip file Bob Rossi <bob@brasko.net> - 2012-03-05 21:14 -0500
    Re: Error with co_filename when loading modules from zip file Bob Rossi <bob@brasko.net> - 2012-03-05 21:40 -0500
      Re: Error with co_filename when loading modules from zip file Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-03-06 02:38 -0800
        Re: Error with co_filename when loading modules from zip file Bob Rossi <bob@brasko.net> - 2012-03-06 08:41 -0500
        Re: Error with co_filename when loading modules from zip file Peter Otten <__peter__@web.de> - 2012-03-06 14:59 +0100

csiph-web