On Wed, Jun 13, 2012 at 9:13 PM, R. David Murray <span dir="ltr"><<a href="mailto:rdmurray@bitdance.com" target="_blank">rdmurray@bitdance.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, 13 Jun 2012 20:46:50 +0200, Antoine Pitrou <<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>> wrote:<br>
> On Wed, 13 Jun 2012 11:20:24 -0700<br>
> Toshio Kuratomi <<a href="mailto:a.badger@gmail.com">a.badger@gmail.com</a>> wrote:<br>
> > On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote:<br>
> > ><br>
> > > OK, but you didn't answer the question :). If I understand correctly,<br>
> > > everything you said applies to *writing* the bytecode, not reading it.<br>
> > ><br>
> > > So, is there any reason to not use the .pyo file (if that's all that is<br>
> > > around) when -O is not specified?<br>
> > ><br>
> > > The only technical reason I can see why -O should be required for a .pyo<br>
> > > file to be used (*if* it is the only thing around) is if it won't *run*<br>
> > > without the -O switch. Is there any expectation that that will ever be<br>
> > > the case?<br>
> > ><br>
> > Yes. For instance, if I create a .pyo with -OO it wouldn't have docstrings.<br>
> > Another piece of code can legally import that and try to use the docstring<br>
> > for something. This would fail if only the .pyo was present.<br>
><br>
> Not only docstrings, but also asserts. I think running a pyo without -O<br>
> would be a bug.<br>
<br>
</div>Again, a program that depends on asserts is buggy.<br>
<br>
As Ethan pointed out we are asking about the case where someone is<br>
*deliberately* setting the .pyo file up to be run as the "normal"<br>
case.<br>
<br>
I'm not sure we want to support that, I just want us to be clear<br>
about why we don't :)</blockquote><div><br></div><div>PyPy toolchain is an example of such buggy program. And oh any tests. I would not be impressed if my python read .pyo files out of nowhere when not running with -O flag (I'm trying very hard to never run python with -O, because it's different python after all)</div>