Skip to content

Commit 44fdede

Browse files
gdallegiordano
andauthored
Fix one rng-related type-instability in @testset (#59321)
Co-authored-by: Mosè Giordano <[email protected]>
1 parent fb22420 commit 44fdede

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/Test/src/Test.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,8 @@ function testset_beginend_call(args, tests, source)
19201920
# by wrapping the body in a function
19211921
local default_rng_orig = copy(default_rng())
19221922
local tls_seed_orig = copy(Random.get_tls_seed())
1923-
local tls_seed = isnothing(get_rng(ts)) ? set_rng!(ts, tls_seed_orig) : get_rng(ts)
1923+
local ts_rng = get_rng(ts)
1924+
local tls_seed = isnothing(ts_rng) ? set_rng!(ts, tls_seed_orig) : ts_rng
19241925
try
19251926
# default RNG is reset to its state from last `seed!()` to ease reproduce a failed test
19261927
copy!(Random.default_rng(), tls_seed)

0 commit comments

Comments
 (0)