-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix exports of undefined/missing/conditionally defined symbols #21217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
If we've gone several weeks without this breaking anything, do we even need to export the new Distributed module name? |
|
It also appears there are more symbols being exported but undefined in Base: julia> for m in Base.Docs.modules
for s in names(m)
try
getfield(m,s)
catch e
println("Module: $(m).$(string(s)) gives ", e)
end
end
endgives Module: Base.Filesystem.JL_O_RANDOM gives UndefVarError(:JL_O_RANDOM)
Module: Base.Filesystem.JL_O_SEQUENTIAL gives UndefVarError(:JL_O_SEQUENTIAL)
Module: Base.Filesystem.JL_O_SHORT_LIVED gives UndefVarError(:JL_O_SHORT_LIVED)
Module: Base.Filesystem.JL_O_TEMPORARY gives UndefVarError(:JL_O_TEMPORARY)
Module: Base.MPFR.big_str gives UndefVarError(:big_str)
Module: Base.dSFMT.win32_SystemFunction036! gives UndefVarError(:win32_SystemFunction036!)
Module: Base.SparseArrays.dense gives UndefVarError(:dense)I didn't check them more closely, yet. But from a quick look seems they are all exported but not actually defined. Maybe an automated test for undefined exports would be helpful. I could take a look later and update the PR. |
Yes, we definitely should have this. It seems like it might be good for an export that's undefined by the time a module is closed would be sensible. @JeffBezanson: is there a use case for undefined exports that's the reason we don't error or warn in that situation? |
|
Cc @amitmurthy |
Let's keep the Distributed module name export for now. We should remove the import and re-exports of distributed API from Base in the next iteration when an explicit |
|
I've updated the PR to fix the missing exports (and changed the title accordingly):
Locally, I've got now no erroneous exports anymore. |
| JL_O_TEMPORARY, | ||
| JL_O_SHORT_LIVED, | ||
| JL_O_SEQUENTIAL, | ||
| JL_O_RANDOM, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are likely platform dependent, see src/file_constants.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When grep-ing for those, I don't see them ever being used in a context of the Julia runtime. Only in that header file. What to do ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep them.
|
With the builds failing on Appveyor, it's clear that the 'random' export didn't work as intended, and that the |
It appears `Base.Parallel` has been renamed to `Base.Distributed`, but is still exported. Thus, the export in base/exports.jl is not valid anymore. In particular, when doing e.g. a `[ s for s in names(Base) if typeof(getfield(Base,s))<:Function]` an UnDefVar error is thrown on 'Parallel'. ```jl julia> [ s for s in names(Base) if typeof(getfield(Base,s))<:Function] ERROR: UndefVarError: Parallel not defined Stacktrace: [1] advance_filter(::#JuliaLang#6#8, ::Array{Symbol,1}, ::Tuple{Bool,Symbol,Int64}) at ./iterators.jl:270 [2] next at ./generator.jl:44 [inlined] [3] grow_to!(::Array{Symbol,1}, ::Base.Generator{Base.Iterators.Filter{#JuliaLang#6#8,Array{Symbol,1}},#JuliaLang#5#7}, ::Tuple{Bool,Symbol,Int64}) at ./array.jl:475 [4] grow_to!(::Array{Union{},1}, ::Base.Generator{Base.Iterators.Filter{#JuliaLang#6#8,Array{Symbol,1}},#JuliaLang#5#7}, ::Tuple{Bool,Symbol,Int64}) at ./array.jl:483 [5] grow_to!(::Array{Symbol,1}, ::Base.Generator{Base.Iterators.Filter{#JuliaLang#6#8,Array{Symbol,1}},#JuliaLang#5#7}) at ./array.jl:468 [6] collect(::Base.Generator{Base.Iterators.Filter{#JuliaLang#6#8,Array{Symbol,1}},#JuliaLang#5#7}) at ./array.jl:412 ```
'big_str' is defined in 'int.jl' as macro, and exported in 'exports.jl' as '@big_str'
'dense' is exported but actually never defined anywhere in module 'SparseArray'.
|
Filesystem and random number generator are a bit tricky since I didn't get Julia's dependencies to compile correctly on Windows. Thus, I removed those failing conditional exports for now from the PR.
The following conditionally required exports (Windows only) are not adressed anymore:
I believe this now to be correct and the tests pass. |
|
Is this still a RFC/WIP or is it done? |
|
Should be done. |
|
Thanks. |
It appears in #20486,
Base.Parallelhas been renamed toBase.Distributed, but isstill exported. Thus, the export in base/exports.jl is not valid anymore. In
particular, when doing e.g. a
[ s for s in names(Base) if typeof(getfield(Base,s))<:Function]an UndefVarError is thrown on 'Parallel'.