Commit 12e96689 authored by Guido van Rossum's avatar Guido van Rossum

Fiddle with compact_traceback().

More whitespace cleanup.
parent a0378e1e
...@@ -227,7 +227,7 @@ class dispatcher: ...@@ -227,7 +227,7 @@ class dispatcher:
#self.log_info('adding channel %s' % self) #self.log_info('adding channel %s' % self)
if map is None: if map is None:
map = socket_map map = socket_map
map [self._fileno] = self map[self._fileno] = self
def del_channel(self, map=None): def del_channel(self, map=None):
fd = self._fileno fd = self._fileno
...@@ -235,7 +235,7 @@ class dispatcher: ...@@ -235,7 +235,7 @@ class dispatcher:
map = socket_map map = socket_map
if map.has_key(fd): if map.has_key(fd):
#self.log_info('closing channel %d:%s' % (fd, self)) #self.log_info('closing channel %d:%s' % (fd, self))
del map [fd] del map[fd]
def create_socket(self, family, type): def create_socket(self, family, type):
self.family_and_type = family, type self.family_and_type = family, type
...@@ -461,23 +461,22 @@ class dispatcher_with_send(dispatcher): ...@@ -461,23 +461,22 @@ class dispatcher_with_send(dispatcher):
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def compact_traceback(): def compact_traceback():
t,v,tb = sys.exc_info() t, v, tb = sys.exc_info()
tbinfo = [] tbinfo = []
while 1: assert tb # Must have a traceback
while tb:
tbinfo.append(( tbinfo.append((
tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_filename,
tb.tb_frame.f_code.co_name, tb.tb_frame.f_code.co_name,
str(tb.tb_lineno) str(tb.tb_lineno)
)) ))
tb = tb.tb_next tb = tb.tb_next
if not tb:
break
# just to be safe # just to be safe
del tb del tb
file, function, line = tbinfo[-1] file, function, line = tbinfo[-1]
info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)) + ']' info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo])
return (file, function, line), t, v, info return (file, function, line), t, v, info
def close_all(map=None): def close_all(map=None):
......
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