[pypy-svn] r46395 - pypy/dist/pypy/translator/sandbox
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 7 14:13:04 CEST 2007
Author: arigo
Date: Fri Sep 7 14:13:02 2007
New Revision: 46395
Modified:
pypy/dist/pypy/translator/sandbox/sandlib.py
Log:
Good suggestion by mwh: hide the spamming amounts of reads and writes to
stdin and stdout in interactive sessions.
Modified: pypy/dist/pypy/translator/sandbox/sandlib.py
==============================================================================
--- pypy/dist/pypy/translator/sandbox/sandlib.py (original)
+++ pypy/dist/pypy/translator/sandbox/sandlib.py Fri Sep 7 14:13:02 2007
@@ -205,7 +205,7 @@
args = read_message(child_stdout)
except EOFError, e:
break
- if self.debug:
+ if self.debug and not self.is_spam(fnname, *args):
log.call('%s(%s)' % (fnname,
', '.join([shortrepr(x) for x in args])))
try:
@@ -219,7 +219,7 @@
else:
log.exception('%s' % (e.__class__.__name__,))
else:
- if self.debug:
+ if self.debug and not self.is_spam(fnname, *args):
log.result(shortrepr(answer))
write_message(child_stdin, 0) # error code - 0 for ok
write_message(child_stdin, answer, resulttype)
@@ -227,6 +227,12 @@
returncode = self.wait()
return returncode
+ def is_spam(self, fnname, *args):
+ # To hide the spamming amounts of reads and writes to stdin and stdout
+ # in interactive sessions
+ return (fnname in ('ll_os.ll_os_read', 'll_os.ll_os_write') and
+ args[0] in (0, 1))
+
def handle_message(self, fnname, *args):
if '__' in fnname:
raise ValueError("unsafe fnname")
More information about the Pypy-commit
mailing list