Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions ipykernel/zmqshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

import os
import sys
import time
import warnings
from threading import local

from tornado import ioloop

from IPython.core.interactiveshell import (
InteractiveShell, InteractiveShellABC
)
Expand Down Expand Up @@ -59,6 +56,9 @@
# Functions and classes
#-----------------------------------------------------------------------------

_sentinel = object()


class ZMQDisplayPublisher(DisplayPublisher):
"""A display publisher that publishes data using a ZeroMQ PUB socket."""

Expand Down Expand Up @@ -93,7 +93,12 @@ def _hooks(self):
self._thread_local.hooks = []
return self._thread_local.hooks

def publish(self, data, metadata=None, source=None, transient=None,
def publish(
self,
data,
metadata=None,
source=_sentinel,
transient=None,
update=False,
):
"""Publish a display-data message
Expand All @@ -110,7 +115,23 @@ def publish(self, data, metadata=None, source=None, transient=None,
Transient data should not be persisted to documents.
update: bool, optional, keyword-only
If True, send an update_display_data message instead of display_data.
source : unused
Value will have no effect on function behavior. Parameter is still
present for backward compatibility but will be removed in the
future.

.. deprecated:: 4.0.1

`source` has been deprecated and no-op since ipykernel 4.0.1
(2015)
"""
if source is not _sentinel:
warnings.warn(
"`source` has been deprecated since ipykernel 4.0.1 "
"and will have no effect",
DeprecationWarning,
stacklevel=2,
)
self._flush_streams()
if metadata is None:
metadata = {}
Expand Down Expand Up @@ -555,8 +576,13 @@ def _showtraceback(self, etype, evalue, stb):
if dh.topic:
topic = dh.topic.replace(b'execute_result', b'error')

exc_msg = dh.session.send(dh.pub_socket, 'error', json_clean(exc_content),
dh.parent_header, ident=topic)
dh.session.send(
dh.pub_socket,
"error",
json_clean(exc_content),
dh.parent_header,
ident=topic,
)

# FIXME - Once we rely on Python 3, the traceback is stored on the
# exception object, so we shouldn't need to store it here.
Expand Down