Skip to content

Commit 3057e3e

Browse files
authored
Fix errors in Julia v1.12 (#507)
1 parent 2e9fb5a commit 3057e3e

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

.github/workflows/CI-Julia-nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ jobs:
5858
- uses: julia-actions/julia-runtest@v1
5959
env:
6060
GROUP: ${{ matrix.group }}
61+
JULIA_NUM_THREADS: auto

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Implement `EnrSpace` and corresponding functionality. ([#500])
1111
- Check for orthogonality breakdown in `Lanczos` solver for `spectrum`. ([#501])
12+
- Fix errors in `Julia v1.12`. ([#507])
1213

1314
## [v0.32.1]
1415
Release date: 2025-06-24
@@ -258,3 +259,4 @@ Release date: 2024-11-13
258259
[#494]: https://github.com/qutip/QuantumToolbox.jl/issues/494
259260
[#500]: https://github.com/qutip/QuantumToolbox.jl/issues/500
260261
[#501]: https://github.com/qutip/QuantumToolbox.jl/issues/501
262+
[#507]: https://github.com/qutip/QuantumToolbox.jl/issues/507

src/qobj/quantum_object_evo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ Parse the `op_func_list` and generate the data for the `QuantumObjectEvolution`
381381

382382
op = :(op_func_list[$i][1])
383383
dims_expr = (dims_expr..., :($op.dimensions))
384-
func_methods_expr = (func_methods_expr..., :(methods(op_func_list[$i][2], [Any, Real]))) # [Any, Real] means each func must accept 2 arguments
384+
func_methods_expr = (func_methods_expr..., :(methods(op_func_list[$i][2], [Any, Real]).ms)) # [Any, Real] means each func must accept 2 arguments
385385
if i == 1
386386
first_op = :($op)
387387
end
@@ -406,10 +406,10 @@ Parse the `op_func_list` and generate the data for the `QuantumObjectEvolution`
406406

407407
# check if each func accepts 2 arguments
408408
func_methods = tuple($(func_methods_expr...))
409-
for f_method in func_methods
410-
length(f_method.ms) == 0 && throw(
409+
for i in eachindex(func_methods)
410+
length(func_methods[i]) == 0 && throw(
411411
ArgumentError(
412-
"The following function must accept two arguments: `$(f_method.mt.name)(p, t)` with t<:Real",
412+
"The following function must only accept two arguments: `$(nameof(op_func_list[i][2]))(p, t)` with t<:Real",
413413
),
414414
)
415415
end

src/time_evolution/brmesolve.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ function brmesolve(
189189
end
190190

191191
function _check_br_spectra(f::Function)
192-
meths = methods(f, [Real])
193-
length(meths.ms) == 0 &&
194-
throw(ArgumentError("The following function must accept one argument: `$(meths.mt.name)(ω)` with ω<:Real"))
192+
length(methods(f, [Real]).ms) == 0 &&
193+
throw(ArgumentError("The following function must only accept one argument: `$(nameof(f))(ω)` with ω<:Real"))
195194
return nothing
196195
end

test/core-test/time_evolution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ end
568568
ntraj = ntraj,
569569
progress_bar = Val(false),
570570
)
571-
@test allocs_tot < 1100 * ntraj + 1800 # TODO: Fix this high number of allocations
571+
@test allocs_tot < 1100 * ntraj + 2300 # TODO: Fix this high number of allocations
572572

573573
allocs_tot = @allocations smesolve(
574574
H,

0 commit comments

Comments
 (0)