summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-09-13 14:09:26 (GMT)
committerGuido van Rossum <guido@python.org>2002-09-13 14:09:26 (GMT)
commit12e96689894d81be290a51d9e62c138ac1230acd (patch)
tree20a89b272e42cbcf9c54d2dab590753b0d1e60aa /Lib
parenta0378e1eda4efb9861b66e28b69d42e02d9ad845 (diff)
downloadcpython-12e96689894d81be290a51d9e62c138ac1230acd.zip
cpython-12e96689894d81be290a51d9e62c138ac1230acd.tar.gz
cpython-12e96689894d81be290a51d9e62c138ac1230acd.tar.bz2
Fiddle with compact_traceback().
More whitespace cleanup.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncore.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index e491f4d..5ab6225 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -227,7 +227,7 @@ class dispatcher:
#self.log_info('adding channel %s' % self)
if map is None:
map = socket_map
- map [self._fileno] = self
+ map[self._fileno] = self
def del_channel(self, map=None):
fd = self._fileno
@@ -235,7 +235,7 @@ class dispatcher:
map = socket_map
if map.has_key(fd):
#self.log_info('closing channel %d:%s' % (fd, self))
- del map [fd]
+ del map[fd]
def create_socket(self, family, type):
self.family_and_type = family, type
@@ -461,23 +461,22 @@ class dispatcher_with_send(dispatcher):
# ---------------------------------------------------------------------------
def compact_traceback():
- t,v,tb = sys.exc_info()
+ t, v, tb = sys.exc_info()
tbinfo = []
- while 1:
+ assert tb # Must have a traceback
+ while tb:
tbinfo.append((
tb.tb_frame.f_code.co_filename,
tb.tb_frame.f_code.co_name,
str(tb.tb_lineno)
))
tb = tb.tb_next
- if not tb:
- break
# just to be safe
del tb
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
def close_all(map=None):