Jason R. Coombs <jaraco@jaraco.com> added the comment:
Are the methods expected to raise specific exception types (e.g. if a resource is missing, or you call iterdir on a “file”)?
The short answer is no. The protocol does not stipulate specific exceptions. Perhaps it should be documented that any exceptions that occur when accessing the backing resource will propagate. Although, I do believe that statement is true for all Python code unless stated otherwise. I agree it would be nice if the protocol could stipulate which exceptions might be raised by a given implementation, but I'm not confident that's possible, at least not without wrapping/adapting the pathlib.Path and zipfile.Path objects. Does that answer the question? Are you working on another provider that implements this protocol? I'd be happy to consult on that effort. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue47142> _______________________________________