From de66580720c03e1cab89e37330aff1bb543a116f Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Tue, 30 Jan 2024 15:50:20 -0500 Subject: [PATCH] put a try catch around calls to propertynames --- stdlib/REPL/src/REPLCompletions.jl | 11 +++++++---- stdlib/REPL/test/replcompletions.jl | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl index 02e6f36ad93ca..ed58e41be470a 100644 --- a/stdlib/REPL/src/REPLCompletions.jl +++ b/stdlib/REPL/src/REPLCompletions.jl @@ -190,11 +190,14 @@ function complete_symbol(@nospecialize(ex), name::String, @nospecialize(ffunc), append!(suggestions, filtered_mod_names(p, mod, name, true, false)) end elseif val !== nothing # looking for a property of an instance - for property in propertynames(val, false) - # TODO: support integer arguments (#36872) - if property isa Symbol && startswith(string(property), name) - push!(suggestions, PropertyCompletion(val, property)) + try + for property in propertynames(val, false) + # TODO: support integer arguments (#36872) + if property isa Symbol && startswith(string(property), name) + push!(suggestions, PropertyCompletion(val, property)) + end end + catch end elseif field_completion_eligible(t) # Looking for a member of a type diff --git a/stdlib/REPL/test/replcompletions.jl b/stdlib/REPL/test/replcompletions.jl index ac4f34b7b9180..49838d4879dab 100644 --- a/stdlib/REPL/test/replcompletions.jl +++ b/stdlib/REPL/test/replcompletions.jl @@ -2247,3 +2247,8 @@ let s = "using ...Issue52922.Inn" @test res @test "Inner2" in c end + +struct Issue53126 +end +Base.propertynames(::Type{A}) = error() +@test isempty(test_complete_foo(A))