Skip to content

Commit

Permalink
Add helpful message when passed bytes to gettz
Browse files Browse the repository at this point in the history
  • Loading branch information
labrys committed Jul 8, 2019
1 parent 29c80ec commit a49815b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dateutil/tz/tz.py
Expand Up @@ -1615,8 +1615,14 @@ def nocache(name=None):
else:
tz = tzlocal()
else:
if name.startswith(":"):
name = name[1:]
try:
if name.startswith(":"):
name = name[1:]
except TypeError:
if isinstance(name, bytes):
raise TypeError('gettz arg should be str, not bytes')
else:
raise
if os.path.isabs(name):
if os.path.isfile(name):
tz = tzfile(name)
Expand Down

0 comments on commit a49815b

Please sign in to comment.