[pypy-svn] r33071 - pypy/dist/pypy/translator/tool

arigo at codespeak.net arigo at codespeak.net
Mon Oct 9 20:43:54 CEST 2006


Author: arigo
Date: Mon Oct  9 20:43:53 2006
New Revision: 33071

Modified:
   pypy/dist/pypy/translator/tool/pdbplus.py
Log:
A decorator that throws you in a pdbplus if the given function raises.


Modified: pypy/dist/pypy/translator/tool/pdbplus.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pdbplus.py	(original)
+++ pypy/dist/pypy/translator/tool/pdbplus.py	Mon Oct  9 20:43:53 2006
@@ -459,3 +459,15 @@
         debugger.start()
         start()
         debugger.join()
+
+
+def pdbcatch(f):
+    "A decorator that throws you in a pdbplus if the given function raises."
+    def wrapper(*args, **kwds):
+        try:
+            return f(*args, **kwds)
+        except:
+            import sys
+            PdbPlusShow(None).post_mortem(sys.exc_info()[2])
+            raise
+    return wrapper



More information about the Pypy-commit mailing list