https://github.com/JuliaLang/julia
Revision 9e8fe688c5e32bde3ab48bb71f9d4ab45ef272ee authored by Valentin Churavy on 24 November 2023, 22:35:51 UTC, committed by GitHub on 24 November 2023, 22:35:51 UTC
Fixes #52213 Overwritting methods during cache creation is currently not something that the system can support and can lead to surprising, counter-intuitive and fatal errors. In 1.10 we turned it from a warning to a strong error, with this PR it remains a strong error, but the precompilation system recognizes it and essentially sets `__precompile__(false)` for this module and all modules that depend on it. Before: ``` julia> using OverwriteMethodError [ Info: Precompiling OverwriteMethodError [top-level] WARNING: Method definition +(Bool, Bool) in module Base at bool.jl:166 overwritten in module OverwriteMethodError at /home/vchuravy/src/julia2/OverwriteMethodError.jl:2. ERROR: LoadError: Method overwriting is not permitted during Module precompile. Stacktrace: [1] top-level scope @ ~/src/julia2/OverwriteMethodError.jl:2 [2] include @ Base ./Base.jl:489 [inlined] [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing) @ Base ./loading.jl:2216 [4] top-level scope @ stdin:3 in expression starting at /home/vchuravy/src/julia2/OverwriteMethodError.jl:1 in expression starting at stdin:3 ERROR: Failed to precompile OverwriteMethodError [top-level] to "/home/vchuravy/.julia/compiled/v1.10/jl_guiuCQ". Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool) @ Base ./loading.jl:2462 [3] compilecache @ Base ./loading.jl:2334 [inlined] [4] (::Base.var"#968#969"{Base.PkgId})() @ Base ./loading.jl:1968 [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool}) @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:93 [6] #mkpidlock#6 @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:88 [inlined] [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64}) @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:111 [8] #invokelatest#2 @ Base ./essentials.jl:889 [inlined] [9] invokelatest @ Base ./essentials.jl:884 [inlined] [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64) @ Base ./loading.jl:2977 [11] maybe_cachefile_lock @ Base ./loading.jl:2974 [inlined] [12] _require(pkg::Base.PkgId, env::String) @ Base ./loading.jl:1964 [13] __require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1806 [14] #invoke_in_world#3 @ Base ./essentials.jl:921 [inlined] [15] invoke_in_world @ Base ./essentials.jl:918 [inlined] [16] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1797 [17] macro expansion @ Base ./loading.jl:1784 [inlined] [18] macro expansion @ Base ./lock.jl:267 [inlined] [19] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1747 [20] #invoke_in_world#3 @ Base ./essentials.jl:921 [inlined] [21] invoke_in_world @ Base ./essentials.jl:918 [inlined] [22] require(into::Module, mod::Symbol) @ Base ./loading.jl:1740 ``` After: ``` julia> using OverwriteMethodError ┌ Info: Precompiling OverwriteMethodError [top-level] └ @ Base loading.jl:2486 WARNING: Method definition +(Bool, Bool) in module Base at bool.jl:166 overwritten in module OverwriteMethodError at /home/vchuravy/src/julia2/OverwriteMethodError.jl:2. ERROR: Method overwriting is not permitted during Module precompile. ┌ Info: Skipping precompilation since __precompile__(false). Importing OverwriteMethodError [top-level]. └ @ Base loading.jl:2084 ``` --------- Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com>
1 parent 6e23543
Tip revision: 9e8fe688c5e32bde3ab48bb71f9d4ab45ef272ee authored by Valentin Churavy on 24 November 2023, 22:35:51 UTC
Turn Method Overwritten Error into a PrecompileError -- turning off caching (#52214)
Turn Method Overwritten Error into a PrecompileError -- turning off caching (#52214)
Tip revision: 9e8fe68
File | Mode | Size |
---|---|---|
checksums | ||
patches | ||
tools | ||
valgrind | ||
.gitignore | -rw-r--r-- | 26 bytes |
JuliaSyntax.mk | -rw-r--r-- | 677 bytes |
JuliaSyntax.version | -rw-r--r-- | 244 bytes |
Makefile | -rw-r--r-- | 6.0 KB |
blastrampoline.mk | -rw-r--r-- | 2.1 KB |
blastrampoline.version | -rw-r--r-- | 196 bytes |
clang.version | -rw-r--r-- | 123 bytes |
csl.mk | -rw-r--r-- | 5.2 KB |
csl.version | -rw-r--r-- | 57 bytes |
curl.mk | -rw-r--r-- | 3.4 KB |
curl.version | -rw-r--r-- | 95 bytes |
dsfmt.mk | -rw-r--r-- | 2.2 KB |
dsfmt.version | -rw-r--r-- | 76 bytes |
gfortblas.alias | -rw-r--r-- | 706 bytes |
gfortblas.c | -rw-r--r-- | 4.4 KB |
gmp.mk | -rw-r--r-- | 3.5 KB |
gmp.version | -rw-r--r-- | 70 bytes |
ittapi.mk | -rw-r--r-- | 1.6 KB |
ittapi.version | -rw-r--r-- | 91 bytes |
libgit2.mk | -rw-r--r-- | 3.7 KB |
libgit2.version | -rw-r--r-- | 429 bytes |
libssh2.mk | -rw-r--r-- | 2.4 KB |
libssh2.version | -rw-r--r-- | 167 bytes |
libsuitesparse.mk | -rw-r--r-- | 3.9 KB |
libsuitesparse.version | -rw-r--r-- | 161 bytes |
libtracyclient.mk | -rw-r--r-- | 3.4 KB |
libtracyclient.version | -rw-r--r-- | 227 bytes |
libuv.mk | -rw-r--r-- | 2.4 KB |
libuv.version | -rw-r--r-- | 154 bytes |
libwhich.mk | -rw-r--r-- | 1.2 KB |
libwhich.version | -rw-r--r-- | 78 bytes |
lld.version | -rw-r--r-- | 60 bytes |
llvm-options.mk | -rw-r--r-- | 564 bytes |
llvm-tools.version | -rw-r--r-- | 182 bytes |
llvm-ver.make | -rw-r--r-- | 664 bytes |
llvm.mk | -rw-r--r-- | 11.8 KB |
llvm.version | -rw-r--r-- | 919 bytes |
llvmunwind.version | -rw-r--r-- | 95 bytes |
mbedtls.mk | -rw-r--r-- | 3.4 KB |
mbedtls.version | -rw-r--r-- | 83 bytes |
mpfr.mk | -rw-r--r-- | 2.4 KB |
mpfr.version | -rw-r--r-- | 73 bytes |
nghttp2.mk | -rw-r--r-- | 2.0 KB |
nghttp2.version | -rw-r--r-- | 102 bytes |
objconv.mk | -rw-r--r-- | 1.0 KB |
objconv.version | -rw-r--r-- | 264 bytes |
openblas.mk | -rw-r--r-- | 8.3 KB |
openblas.version | -rw-r--r-- | 227 bytes |
openlibm.mk | -rw-r--r-- | 1.3 KB |
openlibm.version | -rw-r--r-- | 163 bytes |
p7zip.mk | -rw-r--r-- | 1.6 KB |
p7zip.version | -rw-r--r-- | 76 bytes |
patchelf.mk | -rw-r--r-- | 2.2 KB |
patchelf.version | -rw-r--r-- | 112 bytes |
pcre.mk | -rw-r--r-- | 2.2 KB |
pcre.version | -rw-r--r-- | 74 bytes |
sanitizers.mk | -rw-r--r-- | 1017 bytes |
unwind.mk | -rw-r--r-- | 6.5 KB |
unwind.version | -rw-r--r-- | 106 bytes |
utf8proc.mk | -rw-r--r-- | 1.5 KB |
utf8proc.version | -rw-r--r-- | 78 bytes |
zlib.mk | -rw-r--r-- | 1.4 KB |
zlib.version | -rw-r--r-- | 164 bytes |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...