summaryrefslogtreecommitdiffstats
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2011-11-07 18:43:05 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2011-11-07 18:43:05 (GMT)
commit5252f9faee97573f5b8ff37d7c22225e5df6cc0b (patch)
tree780ab582475f423f45005bb673623e3e007e7716 /Lib/logging/__init__.py
parent1cdbf57c7cabaa0451cfcf04583f31c9a7eab38d (diff)
downloadcpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.zip
cpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.tar.gz
cpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.tar.bz2
logging: replace codecs.open with builtins.open, remove '_encoded' sort, add some tests.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 988cbed..25acb3f 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -36,11 +36,6 @@ __all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR',
'getLogRecordFactory', 'setLogRecordFactory', 'lastResort']
try:
- import codecs
-except ImportError: #pragma: no cover
- codecs = None
-
-try:
import threading
except ImportError: #pragma: no cover
threading = None
@@ -954,8 +949,6 @@ class FileHandler(StreamHandler):
"""
#keep the absolute path, otherwise derived classes which use this
#may come a cropper when the current directory changes
- if codecs is None: #pragma: no cover
- encoding = None
self.baseFilename = os.path.abspath(filename)
self.mode = mode
self.encoding = encoding
@@ -983,11 +976,7 @@ class FileHandler(StreamHandler):
Open the current base file with the (original) mode and encoding.
Return the resulting stream.
"""
- if self.encoding is None:
- stream = open(self.baseFilename, self.mode)
- else:
- stream = codecs.open(self.baseFilename, self.mode, self.encoding)
- return stream
+ return open(self.baseFilename, self.mode, encoding=self.encoding)
def emit(self, record):
"""