]> granicus.if.org Git - python/commitdiff
Closes #13661: Check added for type of logger name.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 7 Nov 2011 08:53:03 +0000 (08:53 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 7 Nov 2011 08:53:03 +0000 (08:53 +0000)
Lib/logging/__init__.py
Lib/test/test_logging.py

index de5392beca84a23c0ac0fb12645164c3d7db5b5d..bea290eff1a13036bae370d9ba7c8462a23cd7c0 100644 (file)
@@ -1094,6 +1094,8 @@ class Manager(object):
         placeholder to now point to the logger.
         """
         rv = None
+        if not isinstance(name, str):
+            raise ValueError('A logger name must be a string')
         _acquireLock()
         try:
             if name in self.loggerDict:
index 90d293e3abe6e0fc4e1146a500d4c3e538722beb..a022680d4d2648acfba707ba7ec0b5b95d560019 100644 (file)
@@ -293,6 +293,8 @@ class BuiltinLevelsTest(BaseTest):
             ('INF.BADPARENT', 'INFO', '4'),
         ])
 
+    def test_invalid_name(self):
+        self.assertRaises(ValueError, logging.getLogger, any)
 
 class BasicFilterTest(BaseTest):