Skip to content

Commit 36b60b7

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #30303, escaping $ when showing Symbols (#30304)
* fix #30303, escaping $ when showing Symbols * use repr instead of escape_string (cherry picked from commit f0b9499)
1 parent 797a24d commit 36b60b7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ function show_unquoted_quote_expr(io::IO, @nospecialize(value), indent::Int, pre
10311031
print(io, ":")
10321032
print(io, value)
10331033
else
1034-
print(io, "Symbol(\"", escape_string(s), "\")")
1034+
print(io, "Symbol(", repr(s), ")")
10351035
end
10361036
else
10371037
if isa(value,Expr) && value.head === :block

test/show.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,3 +1416,6 @@ end
14161416
replstrcolor(x) = sprint((io, x) -> show(IOContext(io, :limit => true, :color => true),
14171417
MIME("text/plain"), x), x)
14181418
@test occursin("\e[", replstrcolor(`curl abc`))
1419+
1420+
# issue #30303
1421+
@test repr(Symbol("a\$")) == "Symbol(\"a\\\$\")"

0 commit comments

Comments
 (0)