Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stringify variables that are not json serializable in inspectVariable… #702

Merged
merged 1 commit into from
Jun 30, 2021
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
9 changes: 8 additions & 1 deletion ipykernel/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from IPython.core.getipython import get_ipython
import debugpy

from .jsonutil import json_clean

# Required for backwards compatiblity
ROUTING_ID = getattr(zmq, 'ROUTING_ID', None) or zmq.IDENTITY

Expand Down Expand Up @@ -417,9 +419,14 @@ async def inspectVariables(self, message):
var_list = []
for k, v in get_ipython().user_ns.items():
if self.accept_variable(k):
try:
val = json_clean(v)

except ValueError:
val = str(v)
var_list.append({
'name': k,
'value': v,
'value': val,
'type': str(type(v))[8:-2],
'variablesReference': 0
})
Expand Down