#9018: os.path.normcase() now raises a TypeError if the argument is not str or bytes.

This commit is contained in:
Ezio Melotti 2010-06-25 10:56:11 +00:00
parent 6186bfb735
commit 5a3ef5b22a
7 changed files with 27 additions and 7 deletions

View file

@ -32,6 +32,9 @@ def _get_colon(path):
# Normalize the case of a pathname. Dummy in Posix, but <s>.lower() here.
def normcase(path):
if not isinstance(path, (bytes, str)):
raise TypeError("normcase() argument must be str or bytes, "
"not '{}'".format(path.__class__.__name__))
return path.lower()