mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
Issue 5013: Fixed bug in FileHandler when delay was set.
This commit is contained in:
parent
29d9381625
commit
6badbe9f76
2 changed files with 15 additions and 12 deletions
|
@ -21,7 +21,7 @@ comp.lang.python, and influenced by Apache's log4j system.
|
||||||
Should work under Python versions >= 1.5.2, except that source line
|
Should work under Python versions >= 1.5.2, except that source line
|
||||||
information is not available unless 'sys._getframe()' is.
|
information is not available unless 'sys._getframe()' is.
|
||||||
|
|
||||||
Copyright (C) 2001-2008 Vinay Sajip. All Rights Reserved.
|
Copyright (C) 2001-2009 Vinay Sajip. All Rights Reserved.
|
||||||
|
|
||||||
To use, simply 'import logging' and log away!
|
To use, simply 'import logging' and log away!
|
||||||
"""
|
"""
|
||||||
|
@ -47,7 +47,7 @@ except ImportError:
|
||||||
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
|
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
|
||||||
__status__ = "production"
|
__status__ = "production"
|
||||||
__version__ = "0.5.0.5"
|
__version__ = "0.5.0.5"
|
||||||
__date__ = "24 January 2008"
|
__date__ = "20 January 2009"
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Miscellaneous module data
|
# Miscellaneous module data
|
||||||
|
@ -730,7 +730,6 @@ class StreamHandler(Handler):
|
||||||
if strm is None:
|
if strm is None:
|
||||||
strm = sys.stderr
|
strm = sys.stderr
|
||||||
self.stream = strm
|
self.stream = strm
|
||||||
self.formatter = None
|
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
"""
|
"""
|
||||||
|
@ -785,10 +784,12 @@ class FileHandler(StreamHandler):
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
if delay:
|
if delay:
|
||||||
|
#We don't open the stream, but we still need to call the
|
||||||
|
#Handler constructor to set level, formatter, lock etc.
|
||||||
|
Handler.__init__(self)
|
||||||
self.stream = None
|
self.stream = None
|
||||||
else:
|
else:
|
||||||
stream = self._open()
|
StreamHandler.__init__(self, self._open())
|
||||||
StreamHandler.__init__(self, stream)
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
|
@ -820,8 +821,7 @@ class FileHandler(StreamHandler):
|
||||||
constructor, open it before calling the superclass's emit.
|
constructor, open it before calling the superclass's emit.
|
||||||
"""
|
"""
|
||||||
if self.stream is None:
|
if self.stream is None:
|
||||||
stream = self._open()
|
self.stream = self._open()
|
||||||
StreamHandler.__init__(self, stream)
|
|
||||||
StreamHandler.emit(self, record)
|
StreamHandler.emit(self, record)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.6.2
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #5013: Fixed a bug in FileHandler which occurred when the delay
|
||||||
|
parameter was set.
|
||||||
|
|
||||||
- Issue #4935: The overflow checking code in the expandtabs() method common
|
- Issue #4935: The overflow checking code in the expandtabs() method common
|
||||||
to str, bytes and bytearray could be optimized away by the compiler, letting
|
to str, bytes and bytearray could be optimized away by the compiler, letting
|
||||||
the interpreter segfault instead of raising an error.
|
the interpreter segfault instead of raising an error.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue