From: Vinay Sajip Date: Mon, 7 Nov 2011 08:53:03 +0000 (+0000) Subject: Closes #13661: Check added for type of logger name. X-Git-Tag: v3.2.3rc1~415 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61b787e6dd00b1e6e24a12e2d5aa6e9fd1352663;p=thirdparty%2FPython%2Fcpython.git Closes #13661: Check added for type of logger name. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index de5392beca84..bea290eff1a1 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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: diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 90d293e3abe6..a022680d4d26 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -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):