From 5a3ef5b22af607666111c76764db0efffbef82be Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 25 Jun 2010 10:56:11 +0000 Subject: #9018: os.path.normcase() now raises a TypeError if the argument is not str or bytes. --- Lib/ntpath.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/ntpath.py') diff --git a/Lib/ntpath.py b/Lib/ntpath.py index 8d502942fa4..7972aa92c0c 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -78,6 +78,9 @@ def normcase(s): """Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes.""" + if not isinstance(s, (bytes, str)): + raise TypeError("normcase() argument must be str or bytes, " + "not '{}'".format(s.__class__.__name__)) return s.replace(_get_altsep(s), _get_sep(s)).lower() -- cgit v1.2.3