setattr(self, arg, prev_state[arg])
self.prepare()
+ @contextmanager
+ def suspend_colorization(self) -> SimpleContextManager:
+ try:
+ old_can_colorize = self.can_colorize
+ self.can_colorize = False
+ yield
+ finally:
+ self.can_colorize = old_can_colorize
+
+
def finish(self) -> None:
"""Called when a command signals that we're finished."""
pass
command = REPL_COMMANDS[statement]
if callable(command):
# Make sure that history does not change because of commands
- with reader.suspend_history():
+ with reader.suspend_history(), reader.suspend_colorization():
command()
return True
return False
--- /dev/null
+The interactive help mode in the :term:`REPL` no longer incorrectly syntax
+highlights text input as Python code. Contributed by Olga Matoula.