[Stackless] pdb support (baseframe.f_trace)?

Bob Ippolito bob at redivi.com
Mon Feb 2 00:49:05 CET 2004

On Jan 29, 2004, at 11:41 PM, Tom Locke wrote:

> Chris - I desperately need the ability to use pdb.set_trace. Any idea
> how hard it would be to get this working? I'd be happy to help out if I
> can, but I'm not at all up to speed on the innards.
> Maybe there's a rough hack to get this working until a proper solution
> is found?


(warning: rough hack ahead)
try patching your bdb.py so that instead of "while frame" it uses 
"while isinstance(frame, stackless.frame)" .. the problem is that it's 
trying to assign attributes to a baseframe or cframe, which raises.

Something like this (I haven't tried to actually use this, but it does 
let me set_trace() and then bt looks correct):

[meth:stackless/Stackless/test_pdb] bob% diff -u ../../Lib/bdb.py bdb.py
--- ../../Lib/bdb.py    Mon Jan 26 03:18:58 2004
+++ bdb.py      Sun Feb  1 18:40:06 2004
@@ -3,6 +3,7 @@
  import sys
  import os
  import types
+import stackless

  __all__ = ["BdbQuit","Bdb","Breakpoint"]

@@ -171,7 +172,7 @@
          """Start debugging from here."""
          frame = sys._getframe().f_back
-        while frame:
+        while isinstance(frame, stackless.frame):
              frame.f_trace = self.trace_dispatch
              self.botframe = frame
              frame = frame.f_back
@@ -187,7 +188,7 @@
              # no breakpoints; run without debugger overhead
              frame = sys._getframe().f_back
-            while frame and frame is not self.botframe:
+            while isinstance(frame, stackless.frame) and frame is not 
                  del frame.f_trace
                  frame = frame.f_back

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list