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 inspect
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
from eventlet.common import BaseException
|
||||||
from eventlet.support import greenlets as greenlet
|
from eventlet.support import greenlets as greenlet
|
||||||
from eventlet import hubs
|
from eventlet import hubs
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
@@ -106,7 +107,7 @@ call_after_local = greenthread.call_after_local
|
|||||||
call_after_global = greenthread.call_after_global
|
call_after_global = greenthread.call_after_global
|
||||||
|
|
||||||
|
|
||||||
class _SilentException:
|
class _SilentException(BaseException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class FakeTimer(object):
|
class FakeTimer(object):
|
||||||
|
@@ -4,12 +4,14 @@ debugging Eventlet-powered applications."""
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import linecache
|
import linecache
|
||||||
import string
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
__all__ = ['spew', 'unspew', 'format_hub_listeners', 'hub_listener_stacks',
|
__all__ = ['spew', 'unspew', 'format_hub_listeners', 'hub_listener_stacks',
|
||||||
'hub_exceptions', 'tpool_exceptions']
|
'hub_exceptions', 'tpool_exceptions']
|
||||||
|
|
||||||
|
_token_spliter = re.compile('\W+')
|
||||||
|
|
||||||
class Spew(object):
|
class Spew(object):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
@@ -39,16 +41,15 @@ class Spew(object):
|
|||||||
print '%s:%s: %s' % (name, lineno, line.rstrip())
|
print '%s:%s: %s' % (name, lineno, line.rstrip())
|
||||||
if not self.show_values:
|
if not self.show_values:
|
||||||
return self
|
return self
|
||||||
details = '\t'
|
details = []
|
||||||
tokens = line.translate(
|
tokens = _token_spliter.split(line)
|
||||||
string.maketrans(' ,.()', '\0' * 5)).split('\0')
|
|
||||||
for tok in tokens:
|
for tok in tokens:
|
||||||
if tok in frame.f_globals:
|
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:
|
if tok in frame.f_locals:
|
||||||
details += '%s=%r ' % (tok, frame.f_locals[tok])
|
details.append('%s=%r' % (tok, frame.f_locals[tok]))
|
||||||
if details.strip():
|
if details:
|
||||||
print details
|
print "\t%s" % ' '.join(details)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user