[pypy-svn] r34772 - pypy/dist/pypy/translator/tool
arigo at codespeak.net
arigo at codespeak.net
Mon Nov 20 11:51:57 CET 2006
Author: arigo
Date: Mon Nov 20 11:51:56 2006
New Revision: 34772
Modified:
pypy/dist/pypy/translator/tool/pdbplus.py
Log:
Minimal hack waiting for a better solution: raise NoTTY when
trying to start a pdbplus and the output is captured by py.test.
Modified: pypy/dist/pypy/translator/tool/pdbplus.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pdbplus.py (original)
+++ pypy/dist/pypy/translator/tool/pdbplus.py Mon Nov 20 11:51:56 2006
@@ -1,12 +1,16 @@
import pdb
import types
import code
+import sys
from pypy.objspace.flow.model import FunctionGraph
class _EnableGraphic:
def __init__(self, port=None):
self.port = port
+class NoTTY(Exception):
+ pass
+
class PdbPlusShow(pdb.Pdb):
def __init__(self, translator):
@@ -20,6 +24,11 @@
t = t.tb_next
self.interaction(t.tb_frame, t)
+ def preloop(self):
+ if not hasattr(sys.stdout, 'isatty') or not sys.stdout.isatty():
+ raise NoTTY("Cannot start the debugger when stdout is captured.")
+ pdb.Pdb.preloop(self)
+
def expose(self, d):
self.exposed.update(d)
More information about the Pypy-commit
mailing list