On Wed, Jun 13, 2012 at 9:13 PM, R. David Murray <span dir="ltr">&lt;<a href="mailto:rdmurray@bitdance.com" target="_blank">rdmurray@bitdance.com</a>&gt;</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 &lt;<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>&gt; wrote:<br>
&gt; On Wed, 13 Jun 2012 11:20:24 -0700<br>
&gt; Toshio Kuratomi &lt;<a href="mailto:a.badger@gmail.com">a.badger@gmail.com</a>&gt; wrote:<br>
&gt; &gt; On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; OK, but you didn&#39;t answer the question :). If I understand correctly,<br>
&gt; &gt; &gt; everything you said applies to *writing* the bytecode, not reading it.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; So, is there any reason to not use the .pyo file (if that&#39;s all that is<br>
&gt; &gt; &gt; around) when -O is not specified?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The only technical reason I can see why -O should be required for a .pyo<br>
&gt; &gt; &gt; file to be used (*if* it is the only thing around) is if it won&#39;t *run*<br>
&gt; &gt; &gt; without the -O switch. Is there any expectation that that will ever be<br>
&gt; &gt; &gt; the case?<br>
&gt; &gt; &gt;<br>
&gt; &gt; Yes. For instance, if I create a .pyo with -OO it wouldn&#39;t have docstrings.<br>
&gt; &gt; Another piece of code can legally import that and try to use the docstring<br>
&gt; &gt; for something. This would fail if only the .pyo was present.<br>
&gt;<br>
&gt; Not only docstrings, but also asserts. I think running a pyo without -O<br>
&gt; 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 &quot;normal&quot;<br>
case.<br>
<br>
I&#39;m not sure we want to support that, I just want us to be clear<br>
about why we don&#39;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&#39;m trying very hard to never run python with -O, because it&#39;s different python after all)</div>

</div>

AltStyle によって変換されたページ (->オリジナル) /