Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ -235,6 +235,7 @@ def test_bad_keys_paths(self):
"../zoneinfo/America/Los_Angeles", # Traverses above TZPATH
"America/../America/Los_Angeles", # Not normalized
"America/./Los_Angeles",
"",
]

for bad_key in bad_keys:
Expand Down
5 changes: 5 additions & 0 deletions Lib/zoneinfo/_tzpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def find_tzfile(key):


def _validate_tzfile_path(path, _base=_TEST_PATH):
if not path:
raise ValueError(
"ZoneInfo key must not be an empty string"
)

if os.path.isabs(path):
raise ValueError(
f"ZoneInfo keys may not be absolute paths, got: {path}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
handle case of an empty string passed to ZoneInfo
Loading