summaryrefslogtreecommitdiff
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2016-07-22 18:23:04 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2016-07-22 18:23:04 +0100
commit638e6220557db50b01653b410eb12f11b9b8ab1c (patch)
treeb685830fe324decdb9c7a5dc68abb31ccd32c617 /Lib/logging/__init__.py
parentd3afb62b8fb38417c3f0bf6873ed64bd9efd8e43 (diff)
downloadcpython-git-638e6220557db50b01653b410eb12f11b9b8ab1c.tar.gz
Closes #27493: accepted Path objects in file handlers for logging.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index f941f4884b..fd422ea1e5 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2001-2015 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -18,7 +18,7 @@
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
-Copyright (C) 2001-2015 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2016 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
@@ -994,6 +994,8 @@ class FileHandler(StreamHandler):
"""
Open the specified file and use it as the stream for logging.
"""
+ # Issue #27493: add support for Path objects to be passed in
+ filename = os.fspath(filename)
#keep the absolute path, otherwise derived classes which use this
#may come a cropper when the current directory changes
self.baseFilename = os.path.abspath(filename)