Skip to content

Commit 14d2e13

Browse files
author
Christopher Doris
committed
rules return false when pyconvert fails
1 parent 89d2cf3 commit 14d2e13

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compat/multimedia.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function pyshow_rule_mimebundle(io::IO, mime::String, x::Py)
3434
else
3535
data = ans[mime]
3636
end
37-
data = pyconvert(Union{String,Vector{UInt8}}, data)
37+
data = @pyconvert(Union{String,Vector{UInt8}}, data, return false)
3838
if mime == "text/html"
3939
data = String(data)
4040
if occursin("altair-viz-", data) && occursin("document.currentScript.previousElementSibling", data)
@@ -78,7 +78,7 @@ function pyshow_rule_repr(io::IO, mime::String, x::Py)
7878
else
7979
data = ans
8080
end
81-
write(io, pyconvert(Union{String,Vector{UInt8}}, data))
81+
write(io, @pyconvert(Union{String,Vector{UInt8}}, data, return false))
8282
return true
8383
catch exc
8484
if exc isa PyException
@@ -113,7 +113,7 @@ function pyshow_rule_savefig(io::IO, mime::String, x::Py)
113113
end
114114
buf = pyimport("io").BytesIO()
115115
x.savefig(buf, format=format)
116-
data = pyconvert(Vector{UInt8}, buf.getvalue())
116+
data = @pyconvert(Vector{UInt8}, buf.getvalue(), return false)
117117
write(io, data)
118118
plt.close(fig)
119119
return true

0 commit comments

Comments
 (0)