Madison May added the comment:

> I'm currently leaning towards having sys.path_importer_cache store 
> the actual directory name.

Exactly what I meant by "Creating a new entry in sys.path_importer_cache after 
changing directories and importing a new module", but expressed much more 
succinctly :)  Good to see we're on pretty much the same page.


Here's a (very) preliminary patch for the issue that stores the directory name 
as a key in sys.path_importer_cache and ensures module.__file__ is an absolute 
path. 

I've also modified test_path_importer_cache_empty_string in 
test_importlib/import_/test_path.py to use os.getcwd() instead of os.curdir as 
the key for sys.path_importer_cache.

Finally, I've added a test to test_import.py that tests that module.__file__ is 
equivalent to os.path.abspath(module.__file__).

Look it over when you get a chance and let me know what you would change.  
Thanks...

----------
keywords: +patch
Added file: http://bugs.python.org/file31236/Issue18416.patch

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

Reply via email to