[issue43063] zipfile.Path / importlib.resources raises KeyError if a file wasn't found

Jason R. Coombs report at bugs.python.org
Fri Jan 29 17:32:55 EST 2021


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

The change to error handling for zipp.Path was added in https://github.com/jaraco/zipp/issues/46 and released as [3.1.0](https://zipp.readthedocs.io/en/latest/history.html#v3-1-0). Probably that change was incorporated into CPython shortly thereafter with bpo-40564, as you observed.

I agree with you, backporting these as bugfixes doesn't feel appropriate. It is a change in behavior. On the other hand, it's a change within the documented scope of the API (that is, it was never stipulated what the behavior would be). My slight preference is to leave the CPython version alone and to recommend the use of the backports to get Python 3.10 compatibility.

It really comes down to the judgment of the release manager. Łukasz, how do you feel about changing the exception that's raised when a directory or file doesn't exist from a KeyError to a more-appropriate OSError for future compatibility?

----------
nosy: +lukasz.langa

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43063>
_______________________________________


More information about the Python-bugs-list mailing list