Skip to content

Buggy interaction between @eval and delete_method #48802

@LilithHafner

Description

@LilithHafner

I could be missing something, but this seems bad to me:

julia> function track()
           @eval function Base.getindex(A::Array{Int}, i1::Int)
               println("A")
               invoke(getindex, Tuple{Array, Int}, A, i1)
           end
       end
track (generic function with 1 method)

julia> function cleanup()
           Base.delete_method(which(getindex, Tuple{Array{Int},Int}))
       end
cleanup (generic function with 1 method)

julia> [1,7,3][2]
7

julia> track()

julia> [1,7,3][2]
A
7

julia> cleanup()

julia> [1,7,3][2]
7

julia> track()

julia> [1,7,3][2]
7

I would expect to be able to resume tracking again after cleanup. I.e. the final output should also include "A". Replacing getindex with sin does not reproduce this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions