Add println in Julia code and reload, can this be done? (likely bug in WeakKeyDict)

Context: The following command causes a dead-lock in 1.4.0-DEV.407 (2019-10-31) and likely also in 1.3. It works fine in 1.03 and 1.2.

x = WeakKeyDict(:a1 => 4)
push!(x, :a2 => 2) # WARNING: deadlock here

I thought I could add some println statements in setindex!in ‘weakkeydict.jl’ and then include the modified file. Not unexpectedly this didn’t work but I wonder if there is a possibility to change Julia code and then take into account the changes? I rebuild Julia with the make command which worked but took a long time.

(Regarding dead-lock: it hangs when executing https://github.com/JuliaLang/julia/blob/4f649c207a97104d7eb1b9bc3e486d39522f4a5e/base/weakkeydict.jl#L81)

1 Like

See https://github.com/timholy/Revise.jl. For changing Julia’s base code you’d need to say Revise.track(Base) for any changes to take effect.

3 Likes

Incredible. Worked perfectly. Didn’t think that Revise goes that far. Thanks a lot!


Regarding dead-lock. I will make an issue in github soon. [Edit: here is a PR https://github.com/JuliaLang/julia/pull/33756. As mentioned, I’m not 100 % sure about the proposed solution]