Jason R. Coombs <jar...@jaraco.com> added the comment:

This issue stems from improper reliance on implementation details of 
`importlib.resources.path`, which returns a context manager that is designed to 
clean up the file after the context closes. certifi would have encountered the 
same problem on older Pythons if certifi had been installed as a zip egg or 
other non-filesystem-based package.

That said, it is also undesirable for path no longer to return a reference to 
an existing path when one exists. That behavior has come about as the 
importlib.resources API moves from the legacy implementation to the new one 
based on TraversableResources (files function).

I encountered [a similar 
issue](https://github.com/python/cpython/pull/20576#issuecomment-637881341) 
during the original submission, which I addressed by removing the same 
assumption from another library (importlib.metadata).

I believe the best fix here is to restore that assumption while retaining other 
important changes in this patch. Should this assumed behavior also be tested 
(guaranteed)? That I'm less sure about.

> Please respect the beta feature freeze.

I do respect the beta feature freeze. The relevant feature was added prior to 
b1. The reverted change is an incremental fix addressing underlying 
implementation details such as how resources are resolved and removing 
duplicate code paths.

More importantly, the change also addresses a [key interface 
problem](https://github.com/python/cpython/pull/20576#issuecomment-639954228) 
that I identified in b1 - that the previously advertised interface of `loaders` 
supplying `files()` methods is inadequate.

I've put a lot of effort into pulling this all together for 3.9 (three full 
days just this past weekend and hundreds of hours leading up to that). It would 
be a real shame for it to be released in a broken state due to a minor (though 
admittedly impactful) hiccup.

I suspect there's a small change that to the submitted patch that will restore 
the prior expectation and leave the codebase in a healthier state.

I'll prepare that soon.

----------

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

Reply via email to