Kaydet (Commit) 3505bd82 authored tarafından Vinay Sajip's avatar Vinay Sajip

Issue #23207: merged fix from 3.4.

...@@ -1734,8 +1734,8 @@ def basicConfig(**kwargs): ...@@ -1734,8 +1734,8 @@ def basicConfig(**kwargs):
"specified together with 'handlers'") "specified together with 'handlers'")
if handlers is None: if handlers is None:
filename = kwargs.pop("filename", None) filename = kwargs.pop("filename", None)
mode = kwargs.pop("filemode", 'a')
if filename: if filename:
mode = kwargs.pop("filemode", 'a')
h = FileHandler(filename, mode) h = FileHandler(filename, mode)
else: else:
stream = kwargs.pop("stream", None) stream = kwargs.pop("stream", None)
......
...@@ -3607,6 +3607,10 @@ class BasicConfigTest(unittest.TestCase): ...@@ -3607,6 +3607,10 @@ class BasicConfigTest(unittest.TestCase):
handlers=handlers) handlers=handlers)
assertRaises(ValueError, logging.basicConfig, stream=stream, assertRaises(ValueError, logging.basicConfig, stream=stream,
handlers=handlers) 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): def test_handlers(self):
handlers = [ handlers = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment