Vscode-jupyter: text of error messages is not HTML-encoded

Created on 4 Jul 2020  Â·  2Comments  Â·  Source: microsoft/vscode-jupyter

Bug: Notebook Editor, Interactive Window, Editor cells

The text of error messages, i.e. messages attached to raised Exception and Error objects, is not HTML-encoded, potentially disrupting display.

Steps to cause the bug to occur

Raise an exception or error whose message contains < followed by a character in a notebook cell.

Examples:

raise TypeError("array(['1', '2.0', 'a'], dtype='<U32'")
raise TypeError("a<b")
raise TypeError("a<10")
raise TypeError("This is <i>very</i> important!")

Actual behavior

In the first and second case, the error message is truncated in display. In the fourth case, the word 'very' is shown in italics.

image

This last case might be seen to be useful, but the truncating of error messages in other cases is too high a price. Python error messages are not intended to be interpreted as HTML code.

Expected behavior

The error messages should appear verbatim, without interpretation as HTML.

Your Jupyter and/or Python environment

_Please provide as much info as you readily know_

  • Jupyter server running: Local
  • Extension version: 2020.6.91350
  • VS Code version: 1.46.1
  • OS: Linux Debian
  • Virtual environment: conda

Developer Tools Console Output

No relevant output.

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

bug

All 2 comments

Thanks for bringing this to our attention! I can reproduce this behavior. We'll discuss this at our next triage meeting.

To expand the scope a bit, following @greazer’s pointing out that this is the same issue as my microsoft/vscode-jupyter#701: this winds up affecting not just tracebacks, but all output cells that use ANSI color codes and include a < character.

When we investigated the possible scope, we found that potentially 1 million of 8.5 million notebooks in public GitHub repos use ANSI color codes, and will be affected by the bug if they include a < character in a cell that also uses ANSI color. About â…” of the examples in the first few pages were indeed tracebacks, but â…“ were other output that happened to also use color.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlbertDeFusco picture AlbertDeFusco  Â·  4Comments

qdlmcfresh picture qdlmcfresh  Â·  3Comments

ashtou picture ashtou  Â·  3Comments

janosh picture janosh  Â·  4Comments

sonulohani picture sonulohani  Â·  3Comments