mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines Get rid of some remnants of classic classes. types.ClassType == type. Also get rid of almost all uses of the types module and use the builtin name. ........ r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line Remove a use of types, verify commit hook works ........ r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines Fix syntax error introduced by Neal in last checkin. ........
This commit is contained in:
parent
7b955bd125
commit
1325790b93
40 changed files with 161 additions and 202 deletions
|
@ -26,7 +26,7 @@ Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
|
|||
To use, simply 'import logging' and log away!
|
||||
"""
|
||||
|
||||
import sys, os, types, time, cStringIO, traceback
|
||||
import sys, os, time, cStringIO, traceback
|
||||
|
||||
try:
|
||||
import codecs
|
||||
|
@ -48,6 +48,8 @@ __date__ = "16 February 2007"
|
|||
# Miscellaneous module data
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
_unicode = 'unicode' in dir(__builtins__)
|
||||
|
||||
#
|
||||
# _srcfile is used when walking the stack to check when we've got the first
|
||||
# caller stack frame.
|
||||
|
@ -234,7 +236,7 @@ class LogRecord:
|
|||
# 'Value is %d' instead of 'Value is 0'.
|
||||
# For the use case of passing a dictionary, this should not be a
|
||||
# problem.
|
||||
if args and (len(args) == 1) and args[0] and (type(args[0]) == types.DictType):
|
||||
if args and (len(args) == 1) and args[0] and isinstance(args[0], dict):
|
||||
args = args[0]
|
||||
self.args = args
|
||||
self.levelname = getLevelName(level)
|
||||
|
@ -275,11 +277,11 @@ class LogRecord:
|
|||
Return the message for this LogRecord after merging any user-supplied
|
||||
arguments with the message.
|
||||
"""
|
||||
if not hasattr(types, "UnicodeType"): #if no unicode support...
|
||||
if not _unicode: #if no unicode support...
|
||||
msg = str(self.msg)
|
||||
else:
|
||||
msg = self.msg
|
||||
if type(msg) not in (types.UnicodeType, types.StringType):
|
||||
if not isinstance(msg, basestring):
|
||||
try:
|
||||
msg = str(self.msg)
|
||||
except UnicodeError:
|
||||
|
@ -743,7 +745,7 @@ class StreamHandler(Handler):
|
|||
try:
|
||||
msg = self.format(record)
|
||||
fs = "%s\n"
|
||||
if not hasattr(types, "UnicodeType"): #if no unicode support...
|
||||
if not _unicode: #if no unicode support...
|
||||
self.stream.write(fs % msg)
|
||||
else:
|
||||
try:
|
||||
|
@ -1053,7 +1055,7 @@ class Logger(Filterer):
|
|||
|
||||
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
|
||||
"""
|
||||
if type(level) != types.IntType:
|
||||
if not isinstance(level, int):
|
||||
if raiseExceptions:
|
||||
raise TypeError, "level must be an integer"
|
||||
else:
|
||||
|
@ -1103,7 +1105,7 @@ class Logger(Filterer):
|
|||
else:
|
||||
fn, lno, func = "(unknown file)", 0, "(unknown function)"
|
||||
if exc_info:
|
||||
if type(exc_info) != types.TupleType:
|
||||
if not isinstance(exc_info, tuple):
|
||||
exc_info = sys.exc_info()
|
||||
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
|
||||
self.handle(record)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue