def get_trimmed_history(self, maxlength):
if maxlength >= 0:
cut = len(self.history) - maxlength
if cut < 0:
cut = 0
else:
cut = 0
return self.history[cut:]
# --- simplified support for reading multiline Python statements ---
# This duplicates small parts of pyrepl.python_reader. I'm not
# reusing the PythonicReader class directly for two reasons. One is
# to try to keep as close as possible to CPython's prompt. The
# other is that it is the readline module that we are ultimately
# implementing here, and I don't want the built-in raw_input() to
# start trying to read multiline inputs just because what the user
# typed look like valid but incomplete Python code. So we get the
# multiline feature only when using the multiline_input() function
# directly (see _pypy_interact.py).
评论列表
文章目录