py3k - more changes

- _SilentException inherits from BaseException
- eveltnet.debug parsing changed to use re.split instead of string.maketrans and string.translate
This commit is contained in:
amajorek
2010-03-07 04:26:46 -05:00
parent 01c37d5cb2
commit fcd285741b
2 changed files with 11 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import linecache
import inspect
import warnings
from eventlet.common import BaseException
from eventlet.support import greenlets as greenlet
from eventlet import hubs
from eventlet import greenthread
@@ -106,7 +107,7 @@ call_after_local = greenthread.call_after_local
call_after_global = greenthread.call_after_global
class _SilentException:
class _SilentException(BaseException):
pass
class FakeTimer(object):

View File

@@ -4,12 +4,14 @@ debugging Eventlet-powered applications."""
import os
import sys
import linecache
import string
import re
import inspect
__all__ = ['spew', 'unspew', 'format_hub_listeners', 'hub_listener_stacks',
'hub_exceptions', 'tpool_exceptions']
_token_spliter = re.compile('\W+')
class Spew(object):
"""
"""
@@ -39,16 +41,15 @@ class Spew(object):
print '%s:%s: %s' % (name, lineno, line.rstrip())
if not self.show_values:
return self
details = '\t'
tokens = line.translate(
string.maketrans(' ,.()', '\0' * 5)).split('\0')
details = []
tokens = _token_spliter.split(line)
for tok in tokens:
if tok in frame.f_globals:
details += '%s=%r ' % (tok, frame.f_globals[tok])
details.append('%s=%r' % (tok, frame.f_globals[tok]))
if tok in frame.f_locals:
details += '%s=%r ' % (tok, frame.f_locals[tok])
if details.strip():
print details
details.append('%s=%r' % (tok, frame.f_locals[tok]))
if details:
print "\t%s" % ' '.join(details)
return self