Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/test/test_zoneinfo/test_zoneinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,7 @@ def test_reset_tzpath_relative_paths(self):
("/usr/share/zoneinfo", "../relative/path",),
("path/to/somewhere", "../relative/path",),
("/usr/share/zoneinfo", "path/to/somewhere", "../relative/path",),
(pathlib.Path("path/to/somewhere"),)
Comment thread
tungol marked this conversation as resolved.
Outdated
Comment thread
tungol marked this conversation as resolved.
Outdated
]
for input_paths in bad_values:
with self.subTest(input_paths=input_paths):
Expand Down
2 changes: 1 addition & 1 deletion Lib/zoneinfo/_tzpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _parse_python_tzpath(env_var, stacklevel):


def _get_invalid_paths_message(tzpaths):
invalid_paths = (path for path in tzpaths if not os.path.isabs(path))
invalid_paths = (os.fspath(path) for path in tzpaths if not os.path.isabs(path))

prefix = "\n "
indented_str = prefix + prefix.join(invalid_paths)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:meth:`zoneinfo.reset_tzpath` will now raise ``ValueError`` if it encounters
an :class:`os.PathLike` object representing a relative path, along with a
more informative error message. It previously raised ``TypeError`` in this
case.
Loading