From 6cbe507a608465fcc197934d73b5c77f312ff555 2012-05-10 00:07:25 From: Fernando Perez Date: 2012-05-10 00:07:25 Subject: [PATCH] Merge pull request #1691 from minrk/1442 Closes #1442: bug in messaging when cache size is set to 0. --- diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index 04490d6..46b6fd1 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -214,7 +214,7 @@ class IPythonWidget(FrontendWidget): self.log.debug("pyout: %s", msg.get('content', '')) if not self._hidden and self._is_from_this_session(msg): content = msg['content'] - prompt_number = content['execution_count'] + prompt_number = content.get('execution_count', 0) data = content['data'] if data.has_key('text/html'): self._append_plain_text(self.output_sep, True) diff --git a/IPython/frontend/qt/console/rich_ipython_widget.py b/IPython/frontend/qt/console/rich_ipython_widget.py index 8240b99..9570f01 100644 --- a/IPython/frontend/qt/console/rich_ipython_widget.py +++ b/IPython/frontend/qt/console/rich_ipython_widget.py @@ -96,7 +96,7 @@ class RichIPythonWidget(IPythonWidget): """ if not self._hidden and self._is_from_this_session(msg): content = msg['content'] - prompt_number = content['execution_count'] + prompt_number = content.get('execution_count', 0) data = content['data'] if data.has_key('image/svg+xml'): self._pre_image_append(msg, prompt_number) diff --git a/IPython/zmq/displayhook.py b/IPython/zmq/displayhook.py index d9f4251..358c979 100644 --- a/IPython/zmq/displayhook.py +++ b/IPython/zmq/displayhook.py @@ -57,8 +57,7 @@ class ZMQShellDisplayHook(DisplayHook): def write_output_prompt(self): """Write the output prompt.""" - if self.do_full_cache: - self.msg['content']['execution_count'] = self.prompt_count + self.msg['content']['execution_count'] = self.prompt_count def write_format_data(self, format_dict): _encode_binary(format_dict)