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:
@@ -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):
|
||||
|
@@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user