get_unicode_path_from_env_var(): make no-op if it's already unicode

svn: r21561
This commit is contained in:
John Ralls 2013-03-06 01:07:05 +00:00
parent 2dcc870dbc
commit b262eeaab7

View File

@ -141,6 +141,10 @@ def get_unicode_path_from_env_var(path):
:rtype: unicode :rtype: unicode
:returns: The Unicode version of path. :returns: The Unicode version of path.
""" """
#No need to do anything if it's already unicode
if isinstance(path, UNITYPE):
return path
# make only unicode of path of type 'str' # make only unicode of path of type 'str'
if not (isinstance(path, str)): if not (isinstance(path, str)):
raise TypeError("path %s isn't a str" % str(path)) raise TypeError("path %s isn't a str" % str(path))