You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In LLVM.jl, I'm using DocTestSetup to allocate an LLVM context which contains all derived LLVM resources. I'm also cleaning up any previous context, because Documenter.jl currently doesn't have a DocTestTeardown or something like it (#2566):
```@meta
DocTestSetup = quote
using LLVM
# XXX; clean-up previous contexts
while context(; throw_error=false) !== nothing
dispose(context())
end
ctx = Context()
end
```
At the same time, I was using named doctests in order to share variables between different doctests:
```jldoctest mod
julia> mod = LLVM.Module("SomeModule");
```
```jldoctest mod
julia> println(mod)
LLVM.Module("SomeModule")
```
This segfaults, because the DocTestSetup triggers again for the second block, destroying the context in which mod was allocated. This is surprising to me, but I realize it can probably not be changed without breaking existing doctests...
In LLVM.jl, I'm using
DocTestSetup
to allocate an LLVM context which contains all derived LLVM resources. I'm also cleaning up any previous context, because Documenter.jl currently doesn't have aDocTestTeardown
or something like it (#2566):At the same time, I was using named doctests in order to share variables between different doctests:
This segfaults, because the
DocTestSetup
triggers again for the second block, destroying the context in whichmod
was allocated. This is surprising to me, but I realize it can probably not be changed without breaking existing doctests...Contrived MWE demonstrating the issue:
On my system, the second doctest doesn't cause a crash, but doesn't show the correct value.
The text was updated successfully, but these errors were encountered: