Skip to content

prevent precompilation from breaking if Base.PkgId is imported#42329

Merged
JeffBezanson merged 1 commit intomasterfrom
kc/pkgid_lul
Sep 23, 2021
Merged

prevent precompilation from breaking if Base.PkgId is imported#42329
JeffBezanson merged 1 commit intomasterfrom
kc/pkgid_lul

Conversation

@KristofferC
Copy link
Copy Markdown
Member

Problem:

julia> using Base: PkgId

julia> using Example
[ Info: Precompiling Example [7876af07-990d-54b4-ab0e-23690620f79a]
ERROR: UndefVarError: PkgId not defined
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] eval(x::Expr)
   @ Base.MainInclude ./client.jl:453
 [4] top-level scope
   @ none:1
ERROR: Failed to precompile Example [7876af07-990d-54b4-ab0e-23690620f79a] to /home/kc/.julia/compiled/v1.8/Example/jl_lTKLYS.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1483
 [3] compilecache(pkg::PkgId, path::String)
   @ Base ./loading.jl:1427
 [4] _require(pkg::PkgId)
   @ Base ./loading.jl:1137
 [5] require(uuidkey::PkgId)
   @ Base ./loading.jl:1030
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1014

repr will only print a module prefix if the symbol is not existing in Main but the module prefix is unconditionally needed here since the code will be evaluated in another process.

Fixes #40888

`repr` will only print a module prefix if the symbol is not existing in Main but the module prefix is unconditionally needed here since the code will be evaluated in another process.
@KristofferC KristofferC added the packages Package management and loading label Sep 21, 2021
@JeffBezanson
Copy link
Copy Markdown
Member

Great example of #29466...

@JeffBezanson JeffBezanson merged commit 721932d into master Sep 23, 2021
@JeffBezanson JeffBezanson deleted the kc/pkgid_lul branch September 23, 2021 18:52
KristofferC added a commit that referenced this pull request Sep 28, 2021
`repr` will only print a module prefix if the symbol is not existing in Main but the module prefix is unconditionally needed here since the code will be evaluated in another process.
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
…Lang#42329)

`repr` will only print a module prefix if the symbol is not existing in Main but the module prefix is unconditionally needed here since the code will be evaluated in another process.
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
…Lang#42329)

`repr` will only print a module prefix if the symbol is not existing in Main but the module prefix is unconditionally needed here since the code will be evaluated in another process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages Package management and loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange error when running test/loading.jl as a normal file

2 participants