Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/TracebackUtils.py
diff options
context:
space:
mode:
Diffstat (limited to 'sugar/TracebackUtils.py')
-rw-r--r--sugar/TracebackUtils.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/sugar/TracebackUtils.py b/sugar/TracebackUtils.py
index 86e28f9..940381e 100644
--- a/sugar/TracebackUtils.py
+++ b/sugar/TracebackUtils.py
@@ -22,33 +22,33 @@ import signal
haveThreadframe = True
try:
- import threadframe
+ import threadframe
except ImportError:
- haveThreadframe = False
+ haveThreadframe = False
class TracebackHelper(object):
- def __init__(self):
- fname = "%s-%d" % (os.path.basename(sys.argv[0]), os.getpid())
- self._fpath = os.path.join("/tmp", fname)
- print "Tracebacks will be written to %s on SIGUSR1" % self._fpath
- signal.signal(signal.SIGUSR1, self._handler)
+ def __init__(self):
+ fname = "%s-%d" % (os.path.basename(sys.argv[0]), os.getpid())
+ self._fpath = os.path.join("/tmp", fname)
+ print "Tracebacks will be written to %s on SIGUSR1" % self._fpath
+ signal.signal(signal.SIGUSR1, self._handler)
- def __del__(self):
- try:
- os.remove(self._fpath)
- except OSError:
- pass
+ def __del__(self):
+ try:
+ os.remove(self._fpath)
+ except OSError:
+ pass
- def _handler(self, signum, pframe):
- f = open(self._fpath, "a")
- if not haveThreadframe:
- f.write("Threadframe not installed. No traceback available.\n")
- else:
- frames = threadframe.dict()
- for thread_id, frame in frames.iteritems():
- f.write(('-' * 79) + '\n')
- f.write('[Thread %s] %d' % (thread_id, sys.getrefcount(frame)) + '\n')
- traceback.print_stack(frame, limit=None, file=f)
- f.write("\n")
- f.write('\n')
- f.close()
+ def _handler(self, signum, pframe):
+ f = open(self._fpath, "a")
+ if not haveThreadframe:
+ f.write("Threadframe not installed. No traceback available.\n")
+ else:
+ frames = threadframe.dict()
+ for thread_id, frame in frames.iteritems():
+ f.write(('-' * 79) + '\n')
+ f.write('[Thread %s] %d' % (thread_id, sys.getrefcount(frame)) + '\n')
+ traceback.print_stack(frame, limit=None, file=f)
+ f.write("\n")
+ f.write('\n')
+ f.close()