Den ons 4 okt. 2023 kl 06:58 skrev Nathan Hartman <hartman.nat...@gmail.com
>:

> Thanks for the review! Committed in r1912724. More below:
>

Great!


> I see only one issue: FileNotFoundError is new in Python 3, so Python 2
> will fail with a NameError when it sees that. However: On Python 3,
> FileNotFoundError inherits from OSError, OSError exists in Python 2, and
> OSError in both Pythons has the strerror attribute. So (unless I'm missing
> something) we should catch OSError instead of FileNotFoundError here for
> compatibility.
>

Good point. If we catch OSError we should check for err.errno =
errno.ENOENT (as is done in subversion/bindings/swig/python/tests/fs.py).

I don't think anything has formally been decided regarding Python 2
support, we have tried hard to keep Python 2 compatibility in 1.14 but for
/trunk (and a coming 1.15 release) my opinion is that we should remove it.
This should probably be broken out to a separate thread and documented
somewhere.

I think catching FileNotFoundError is cleaner than OSError + check for
ENOENT. Also there is no immediate need to backport to 1.14 (this is just a
better error message). With that in mind, I'm leaning towards keeping
FileNotFoundError (we should probably update tests/fs.py to follow the same
pattern).

Yasuhito / Jun: Since you are Python experts, do you have any comments?

Kind regards,
Daniel

>

Reply via email to