Author: Ronny Pfannschmidt <[email protected]>
Branch: py3ksupport
Changeset: r167:2e5ce6fd51fc
Date: 2012-03-24 16:26 +0100
http://bitbucket.org/pypy/pyrepl/changeset/2e5ce6fd51fc/
Log: initial tracing for unic console
diff --git a/pyrepl/trace.py b/pyrepl/trace.py
new file mode 100644
--- /dev/null
+++ b/pyrepl/trace.py
@@ -0,0 +1,17 @@
+import os
+
+trace_filename = os.environ.get("PYREPL_TRACE")
+
+if trace_filename is not None:
+ trace_file = open(trace_filename, 'a')
+else:
+ trace_file = None
+
+def trace(line, *k, **kw):
+ if trace_file is None:
+ return
+ if k or kw:
+ line = line.format(*k, **kw)
+ trace_file.write(line+'\n')
+ trace_file.flush()
+
diff --git a/pyrepl/unix_console.py b/pyrepl/unix_console.py
--- a/pyrepl/unix_console.py
+++ b/pyrepl/unix_console.py
@@ -26,6 +26,7 @@
from .fancy_termios import tcgetattr, tcsetattr
from .console import Console, Event
from .unix_eventqueue import EventQueue
+from .trace import trace
class InvalidTerminal(RuntimeError):
pass
@@ -410,6 +411,7 @@
self.event_queue.insert(Event('resize', None))
def push_char(self, char):
+ trace('push char {char!r}', char=char)
self.partial_char += char
try:
c = self.partial_char.decode(self.encoding)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit