Closes #13361: Raise correct exception type.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 7 Nov 2011 10:15:08 +0000 (10:15 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 7 Nov 2011 10:15:08 +0000 (10:15 +0000)
Lib/logging/__init__.py
Lib/test/test_logging.py

index bea290eff1a13036bae370d9ba7c8462a23cd7c0..7dacddb066928593ebc1161faaf2105236c59508 100644 (file)
@@ -1095,7 +1095,7 @@ class Manager(object):
         """
         rv = None
         if not isinstance(name, str):
-            raise ValueError('A logger name must be a string')
+            raise TypeError('A logger name must be a string')
         _acquireLock()
         try:
             if name in self.loggerDict:
index a022680d4d2648acfba707ba7ec0b5b95d560019..ab66596d083c65f84b1a401e9e3e61b90d3af9b7 100644 (file)
@@ -294,7 +294,7 @@ class BuiltinLevelsTest(BaseTest):
         ])
 
     def test_invalid_name(self):
-        self.assertRaises(ValueError, logging.getLogger, any)
+        self.assertRaises(TypeError, logging.getLogger, any)
 
 class BasicFilterTest(BaseTest):