[Python-checkins] cpython (merge 3.4 -> default): Issue #23207: merged fix from 3.4.
vinay.sajip
python-checkins at python.org
Wed Mar 18 09:50:07 CET 2015
https://hg.python.org/cpython/rev/7ff0d7b50b36
changeset: 95028:7ff0d7b50b36
parent: 95026:cfe541c694f3
parent: 95027:d3b420807a86
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Wed Mar 18 08:49:57 2015 +0000
summary:
Issue #23207: merged fix from 3.4.
files:
Lib/logging/__init__.py | 2 +-
Lib/test/test_logging.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1734,8 +1734,8 @@
"specified together with 'handlers'")
if handlers is None:
filename = kwargs.pop("filename", None)
+ mode = kwargs.pop("filemode", 'a')
if filename:
- mode = kwargs.pop("filemode", 'a')
h = FileHandler(filename, mode)
else:
stream = kwargs.pop("stream", None)
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
@@ -3607,6 +3607,10 @@
handlers=handlers)
assertRaises(ValueError, logging.basicConfig, stream=stream,
handlers=handlers)
+ # Issue 23207: test for invalid kwargs
+ assertRaises(ValueError, logging.basicConfig, loglevel=logging.INFO)
+ # Should pop both filename and filemode even if filename is None
+ logging.basicConfig(filename=None, filemode='a')
def test_handlers(self):
handlers = [
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list