Skip to content

Commit bf4e638

Browse files
IanButterworthKristofferC
authored andcommitted
Profile: fix heap snapshot is valid char check (#53984)
Followup to #53833 Fixes a failure seen in #53974 (below) I believe this is the more correct check to make? The heapsnapshot generated from this PR is viewable in vscode. ``` 2024-04-06 09:33:58 EDT From worker 7: ERROR: Base.InvalidCharError{Char}('\xc1\xae') 2024-04-06 09:33:58 EDT From worker 7: Stacktrace: 2024-04-06 09:33:58 EDT From worker 7: [1] throw_invalid_char(c::Char) 2024-04-06 09:33:58 EDT From worker 7: @ Base ./char.jl:86 2024-04-06 09:33:58 EDT From worker 7: [2] UInt32 2024-04-06 09:33:58 EDT From worker 7: @ ./char.jl:133 [inlined] 2024-04-06 09:33:58 EDT From worker 7: [3] category_code 2024-04-06 09:33:58 EDT From worker 7: @ ./strings/unicode.jl:339 [inlined] 2024-04-06 09:33:58 EDT From worker 7: [4] isassigned 2024-04-06 09:33:58 EDT From worker 7: @ ./strings/unicode.jl:355 [inlined] 2024-04-06 09:33:58 EDT From worker 7: [5] isassigned 2024-04-06 09:33:58 EDT From worker 7: @ /cache/build/tester-amdci5-14/julialang/julia-master/julia-41d026beaf/share/julia/stdlib/v1.12/Unicode/src/Unicode.jl:138 [inlined] 2024-04-06 09:33:58 EDT From worker 7: [6] print_str_escape_json(stream::IOStream, s::String) 2024-04-06 09:33:58 EDT From worker 7: @ Profile.HeapSnapshot /cache/build/tester-amdci5-14/julialang/julia-master/julia-41d026beaf/share/julia/stdlib/v1.12/Profile/src/heapsnapshot_reassemble.jl:239 2024-04-06 09:33:59 EDT From worker 7: [7] (::Profile.HeapSnapshot.var"#5#6"{IOStream})(strings_io::IOStream) 2024-04-06 09:33:59 EDT From worker 7: @ Profile.HeapSnapshot /cache/build/tester-amdci5-14/julialang/julia-master/julia-41d026beaf/share/julia/stdlib/v1.12/Profile/src/heapsnapshot_reassemble.jl:192 ``` (cherry picked from commit c557636)
1 parent 557268d commit bf4e638

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

stdlib/Manifest.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
191191
version = "1.11.0"
192192

193193
[[deps.Profile]]
194-
deps = ["Unicode"]
195194
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
196195
version = "1.11.0"
197196

stdlib/Profile/Project.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name = "Profile"
22
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
33
version = "1.11.0"
44

5-
[deps]
6-
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
7-
8-
[compat]
9-
Unicode = "1.11.0"
10-
115
[extras]
126
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
137
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"

stdlib/Profile/src/heapsnapshot_reassemble.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
module HeapSnapshot
44

5-
using Unicode
6-
75
"""
86
assemble_snapshot(filepath::AbstractString, out_file::AbstractString)
97
@@ -236,7 +234,7 @@ function print_str_escape_json(stream::IO, s::AbstractString)
236234
print(stream, "\\t")
237235
elseif '\x00' <= c <= '\x1f'
238236
print(stream, "\\u", lpad(string(UInt16(c), base=16), 4, '0'))
239-
elseif !Unicode.isassigned(c)
237+
elseif !isvalid(c)
240238
# we have to do this because vscode's viewer doesn't like the replace character
241239
print(stream, "[invalid unicode character]")
242240
else

0 commit comments

Comments
 (0)