Eric Snow added the comment:

Re: the kw-only arg, it seems weird to accommodate the implementation of one 
meta-path finder in the signature of importlib.invalidate_caches().

Here's an alternative:

Use a different sys.path_importer_cache sentinel internally (in PathFinder) and 
never clear None when clearing the cache.

Here's another alternative:

Deprecate sys.path_importer_cache and move/alias it to an internal cache of 
PathFinder. *  Then add methods to PathFinder to cover the use cases that folks 
have for interacting with sys.path_importer_cache directly.  In this case it 
may also make sense to expose the active PathFinder instance as an importlib 
attribute, for easier access to this key finder.  Doing the same on ImportState 
will be part of my (eventual) proposal. :)

Of course, neither of those alternatives addresses the case where someone 
expects sys.path_importer_cache entries to remain fixed once in place.  
However, that's a tenuous implicit guarantee already. :)


* The same could be done with sys.path_hooks...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26281>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to