[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread Joshua
Joshua added the comment: I'll reopen the PR with an attempted resolution of the OSError related issues however. In my quick testing it seems at least on Linux backports.zoneinfo segfaults when trying `ZoneInfo('__init__.py')` so that might be a larger issue for Paul to look into. --

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread Paul Ganssle
Paul Ganssle added the comment: By the way, it might be easiest to start with a PR against backports.zoneinfo, because I have a lot more linting, coverage and format checks set up there: https://github.com/pganssle/zoneinfo -- ___ Python tracker

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread Paul Ganssle
Paul Ganssle added the comment: I think that `ZoneInfo('__init__.py')` is also a problem, but a slightly different one. That comes from the fact that in order to support `importlib.resources`, each of the zoneinfo subdirectories needs an `__init__.py`, but the ZoneInfo constructor should

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread Joshua
Joshua added the comment: I had opened a PR which just caught IsADirectoryError and PermissionError but closed it as you'd mentioned that handling PermissionError that way probably would not be the best, and I agree. I can reopen and modify to check path on OSerror if you'd like otherwise feel

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread STINNER Victor
STINNER Victor added the comment: Oh, I dislike Roundup UI. I didn't notice that a PR was submitted: PR 21839 (now closed). -- ___ Python tracker ___

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread STINNER Victor
STINNER Victor added the comment: On Linux, converting IsADirectoryError to ZoneInfoNotFoundError is easy. But on Windows, I don't think that converting any PermissionError into a ZoneInfoNotFoundError is a good idea. Maybe if PermissionError happens, we should check if the path is a

[issue41530] zoneinfo: ZoneInfo raises IsADirectoryError instead of ZoneInfoNotFoundError

2020-08-12 Thread STINNER Victor
STINNER Victor added the comment: Oh right, 'Pacific' is a directory, not a valid zone, and so ZoneInfoNotFoundError should be raised. I see. Example: $ ./python -m venv env $ env/bin/python -m pip install tzdata $ env/bin/python # ZoneInfoNotFoundError expected, get IsADirectoryError >>>