[Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Jun 13 07🔞24 CEST 2012


On Wed, Jun 13, 2012 at 11:10 AM, Brett Cannon <brett at python.org> wrote:

> This does mean, though, that imp.cachefromsource() and > imp.sourcefromcache() might need to be updated to raise a reasonable > exception when sys.implementation.cachetag is set to None as I believe > right now it will raise a TypeError because None isn't a str. But what > to > raise instead? TypeError? EnvironmentError? NotImplementedError seems fine for me too if we don't end up using this flag. OK, that's 2 votes for that exception.

That way people are free to use either LBYL (checking cache_tag) or EAFP (catching NotImplementedError).

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list