<br><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 1:18 AM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, Jun 13, 2012 at 11:10 AM, Brett Cannon <<a href="mailto:brett@python.org">brett@python.org</a>> wrote:<br>
>> > This does mean, though, that imp.cache_from_source() and<br>
>> > imp.source_from_cache() might need to be updated to raise a reasonable<br>
>> > exception when sys.implementation.cache_tag is set to None as I believe<br>
>> > right now it will raise a TypeError because None isn't a str. But what<br>
>> > to<br>
>> > raise instead? TypeError? EnvironmentError?<br>
>> NotImplementedError seems fine for me too if we don't end up using this<br>
>> flag.<br>
><br>
> OK, that's 2 votes for that exception.<br>
<br>
</div>+ 1 from me as well, both for skipping any implicit reading or writing<br>
of the cache when cache_tag is None (IIRC, that's the use case we had<br>
in mind when we allowed that field to be None in the PEP 421<br>
discussion), and for *explicit* attempts to access the cache when the<br>
tag is None triggering NotImplementedError.<br>
<br>
That way people are free to use either LBYL (checking cache_tag) or<br>
EAFP (catching NotImplementedError).<br></blockquote><div><br></div><div>I'm sold: <a href="http://bugs.python.org/issue15056">http://bugs.python.org/issue15056</a> for tracking the change. </div></div>