Skip to content

Commit dfba9b1

Browse files
authored
Fix methods tables on Julia 1.12 (#3339)
1 parent 9313203 commit dfba9b1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/runner/PlutoRunner/src/evaluation/deleting globals.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,23 @@ Return whether the function has any methods left after deletion.
136136
function delete_toplevel_methods(f::Function, cell_id::UUID)::Bool
137137
# we can delete methods of functions!
138138
# instead of deleting all methods, we only delete methods that were defined in this notebook. This is necessary when the notebook code extends a function from remote code
139-
methods_table = typeof(f).name.mt
139+
140140
deleted_sigs = Set{Type}()
141-
Base.visit(methods_table) do method # iterates through all methods of `f`, including overridden ones
141+
142+
function handle_method(method)
142143
if isfromcell(method, cell_id) && !is_method_deleted(method)
143144
Base.delete_method(method)
144145
delete_method_doc(method)
145146
push!(deleted_sigs, method.sig)
146147
end
147148
end
148-
149+
150+
if VERSION < v"1.12.0-0"
151+
methods_table = typeof(f).name.mt
152+
Base.visit(handle_method, methods_table) # iterates through all methods of `f`, including overridden ones
153+
else
154+
foreach(handle_method, methods(f))
155+
end
149156

150157
if VERSION < v"1.12.0-0"
151158
# not necessary in Julia after https://github.com/JuliaLang/julia/pull/53415 💛

0 commit comments

Comments
 (0)