diff options
| author | Alexander Smirnov <[email protected]> | 2024-12-19 08:16:17 +0000 |
|---|---|---|
| committer | Alexander Smirnov <[email protected]> | 2024-12-19 08:16:17 +0000 |
| commit | c1c806d731fa634503bf452ee3c603ed956abe2c (patch) | |
| tree | f2a69c7615b518119f1c895672544ce8ad1a4fe4 /contrib/python/ipython/py3/IPython/core/display.py | |
| parent | 892a954b648dfce3da44ad433b2258e303b08b06 (diff) | |
| parent | bb0840c0025a75dd3b85b746ebcec7deb7d9fe1c (diff) | |
Merge branch 'rightlib' into mergelibs-241219-0815
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core/display.py')
| -rw-r--r-- | contrib/python/ipython/py3/IPython/core/display.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/display.py b/contrib/python/ipython/py3/IPython/core/display.py index c3c44016f41..a9434473a82 100644 --- a/contrib/python/ipython/py3/IPython/core/display.py +++ b/contrib/python/ipython/py3/IPython/core/display.py @@ -16,7 +16,8 @@ from copy import deepcopy from os.path import splitext from pathlib import Path, PurePath -from IPython.utils.py3compat import cast_unicode +from typing import Optional + from IPython.testing.skipdoctest import skip_doctest from . import display_functions @@ -518,7 +519,7 @@ class SVG(DisplayObject): _read_flags = 'rb' # wrap data in a property, which extracts the <svg> tag, discarding # document headers - _data = None + _data: Optional[str] = None @property def data(self): @@ -540,8 +541,10 @@ class SVG(DisplayObject): # fallback on the input, trust the user # but this is probably an error. pass - svg = cast_unicode(svg) - self._data = svg + if isinstance(svg, bytes): + self._data = svg.decode(errors="replace") + else: + self._data = svg def _repr_svg_(self): return self._data_and_metadata() |
