[Neo-report] r2062 vincent - /trunk/neo/live_debug.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue May 4 18:36:13 CEST 2010
Author: vincent
Date: Tue May 4 18:36:11 2010
New Revision: 2062
Log:
Fix traceback module use, and factorise code.
Modified:
trunk/neo/live_debug.py
Modified: trunk/neo/live_debug.py
==============================================================================
--- trunk/neo/live_debug.py [iso-8859-1] (original)
+++ trunk/neo/live_debug.py [iso-8859-1] Tue May 4 18:36:11 2010
@@ -38,23 +38,24 @@
# SIGUSR2:
# Triggers a pdb prompt on process' controlling TTY.
+def decorate(func):
+ def decorator(sig, frame):
+ try:
+ func(sig, frame)
+ except:
+ # Prevent exception from exiting signal handler, so mistakes in
+ # "debug" module don't kill process.
+ traceback.print_exc()
+
+ at decorate
def debugHandler(sig, frame):
- try:
- file, filename, (suffix, mode, type) = imp.find_module('debug',
- neo.__path__)
- imp.load_module('neo.debug', file, filename, (suffix, mode, type))
- except:
- # Prevent exception from exiting signal handler, so mistakes in
- # "debug" module don't kill process.
- traceback.print_exception()
+ file, filename, (suffix, mode, type) = imp.find_module('debug',
+ neo.__path__)
+ imp.load_module('neo.debug', file, filename, (suffix, mode, type))
+ at decorate
def pdbHandler(sig, frame):
- try:
- pdb.set_trace()
- except:
- # Prevent exception from exiting signal handler, so mistakes in
- # pdb don't kill process.
- traceback.print_exception()
+ pdb.set_trace()
def register():
if ENABLED:
More information about the Neo-report
mailing list