From 482faec17f1c69784d8cc2757a79809458d71154 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Tue, 2 Dec 2014 10:40:01 +0100 Subject: [PATCH 1/2] Don't capture sys.stderr at import time Signed-off-by: Julien Cristau --- yapps/runtime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yapps/runtime.py b/yapps/runtime.py index 29f91e7..58017fe 100644 --- a/yapps/runtime.py +++ b/yapps/runtime.py @@ -168,10 +168,13 @@ class Scanner(object): # output += '%s\n' % (repr(t),) # return output - def print_line_with_pointer(self, pos, length=0, out=sys.stderr): + def print_line_with_pointer(self, pos, length=0, out=None): """Print the line of 'text' that includes position 'p', along with a second line with a single caret (^) at position p""" + if out is None: + out = sys.stderr + file,line,p = pos if file != self.filename: if self.stack: return self.stack.print_line_with_pointer(pos,length=length,out=out) -- 2.6.4