<p><br>
On Jun 12, 2012 6:24 PM, &quot;<a href="mailto:fwierzbicki@gmail.com">fwierzbicki@gmail.com</a>&quot; &lt;<a href="mailto:fwierzbicki@gmail.com">fwierzbicki@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Tue, Jun 12, 2012 at 12:01 PM, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Tue, Jun 12, 2012 at 2:28 PM, Eric Snow &lt;<a href="mailto:ericsnowcurrently@gmail.com">ericsnowcurrently@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; On Tue, Jun 12, 2012 at 10:48 AM, Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt; wrote:<br>
&gt; &gt;&gt; &gt; I should mention another option is to add sys.dont_read_bytecode (I<br>
&gt; &gt;&gt; &gt; think I<br>
&gt; &gt;&gt; &gt; have discussed this with Frank at some point).<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Or check for &quot;sys.implementation.cache_tag is None&quot;...<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Perfect! Will that work for Jython (Franke) and IronPython (Jeff)?<br>
&gt; So Jython does actually emit bytecodes, but they are Java bytecodes<br>
&gt; instead of Python bytecodes. Right now they end up next to the .py<br>
&gt; files just like .pyc files. They have the possibly unfortunate naming<br>
&gt; foo.py -&gt; foo$py.class -- If I understand cache_tag (I may not) I<br>
&gt; guess Python 3 is putting the .pyc files into hidden subdirectories<br>
&gt; instead of putting them next to the .py files?</p>
<p>Yes, __pycache__. The tag is to allow different versions of bytecode to exist side-by-side (eg for CPython 3.3 it&#39;s cpython33 so the file ends up being named foo-cpython33.pyc).</p>
<p> If so we may do the<br>
&gt; same with our $py.class files.</p>
<p>That was part of the hope when it was designed.</p>
<p>&gt;<br>
&gt; Incidentally we also have a mode for reading .pyc files -- though we<br>
&gt; haven&#39;t implementing writing them yet (we probably will eventually)</p>
<p>If you can read .pyc files then you should be fine.</p>
<p>&gt;<br>
&gt; I guess what I&#39;m trying to say is that I don&#39;t know exactly how we<br>
&gt; will handle these new flags, but chances are we will use them (Again<br>
&gt; provided my guesses about what they do are anywhere near what they<br>
&gt; really do).</p>
<p>IOW it&#39;s too soon to be having this discussion. :) I mean regardless of what happens you can always tweak the import lib code as necessary, I just wanted to try to avoid it.</p>
<p>&gt;<br>
&gt; &gt;<br>
&gt; &gt; This does mean, though, that imp.cache_from_source() and<br>
&gt; &gt; imp.source_from_cache() might need to be updated to raise a reasonable<br>
&gt; &gt; exception when sys.implementation.cache_tag is set to None as I believe<br>
&gt; &gt; right now it will raise a TypeError because None isn&#39;t a str. But what to<br>
&gt; &gt; raise instead? TypeError? EnvironmentError?<br>
&gt; NotImplementedError seems fine for me too if we don&#39;t end up using this flag.</p>
<p>OK, that&#39;s 2 votes for that exception.</p>
<p>&gt;<br>
&gt; -Frank<br>
</p>