[Python-checkins] cpython (3.2): Closes #13661: Check added for type of logger name.
vinay.sajip
python-checkins at python.org
Mon Nov 7 09:55:04 CET 2011
http://hg.python.org/cpython/rev/a3ba905447ba
changeset: 73416:a3ba905447ba
branch: 3.2
parent: 73408:ed0e85efac47
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Mon Nov 07 08:53:03 2011 +0000
summary:
Closes #13661: Check added for type of logger name.
files:
Lib/logging/__init__.py | 2 ++
Lib/test/test_logging.py | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1094,6 +1094,8 @@
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
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -293,6 +293,8 @@
('INF.BADPARENT', 'INFO', '4'),
])
+ def test_invalid_name(self):
+ self.assertRaises(ValueError, logging.getLogger, any)
class BasicFilterTest(BaseTest):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list