From 459cf453ef3e2c03f5d70bd8b646322eb75a55ff Mon Sep 17 00:00:00 2001 From: Mark Kittisopikul Date: Tue, 12 Jan 2021 15:46:48 -0500 Subject: [PATCH 1/2] Fix tests, Core.TypeofVararg for Julia 1.7 and AOT --- .github/workflows/aot.yml | 8 +------- aot/runtests.sh | 2 +- src/conversions.jl | 5 ++++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/aot.yml b/.github/workflows/aot.yml index d12b7db9..ea23d765 100644 --- a/.github/workflows/aot.yml +++ b/.github/workflows/aot.yml @@ -41,13 +41,7 @@ jobs: arch: ${{ matrix.architecture }} show-versioninfo: true - # Revert to `@v1` after this PR is merged: - # https://github.com/JuliaLang/PackageCompiler.jl/pull/443 - - run: julia -e 'using Pkg; pkg"add PackageCompiler#cb994c72e2087c57ffa4727ef93589e1b98d8a32"' - - # Workaround https://github.com/JuliaLang/julia/issues/37441. - # Once it's solved, we can remove the following line: - - run: julia -e 'using Pkg; pkg"dev PyCall"' + - run: julia -e 'using Pkg; pkg"add PackageCompiler@v1"' - run: aot/compile.jl - run: aot/assert_has_pycall.jl diff --git a/aot/runtests.sh b/aot/runtests.sh index 4d5f573b..6f4f2929 100755 --- a/aot/runtests.sh +++ b/aot/runtests.sh @@ -1,6 +1,6 @@ #!/bin/bash thisdir="$(dirname "${BASH_SOURCE[0]}")" -exec "$thisdir/julia.sh" --startup-file=no --color=yes -e ' +exec "$thisdir/julia.sh" --startup-file=no --color=yes --project=$thisdir -e ' using Pkg Pkg.test("PyCall") ' diff --git a/src/conversions.jl b/src/conversions.jl index 540c25b3..9893e721 100644 --- a/src/conversions.jl +++ b/src/conversions.jl @@ -170,7 +170,10 @@ function pyany_toany(T::Type) end pyany_toany(::Type{PyAny}) = Any pyany_toany(t::Type{T}) where {T<:Tuple} = Tuple{map(pyany_toany, t.types)...} - +@static if isdefined(Core, :TypeofVararg) # VERSION >= v"1.7.0-DEV.77" + # Core.TypeofVararg introduced in https://github.com/JuliaLang/julia/pull/38136 + pyany_toany(T::Core.TypeofVararg) = T === Vararg{PyAny} ? Vararg{Any} : T +end # PyAny acts like Any for conversions, except for converting PyObject (below) convert(::Type{PyAny}, x) = x From a3522eed9f0626aa82e12ee42dcabfe3287eba63 Mon Sep 17 00:00:00 2001 From: Mark Kittisopikul Date: Fri, 15 Jan 2021 01:54:04 -0500 Subject: [PATCH 2/2] Replace Core.TypeofVararg with typeof(Vararg) --- src/conversions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conversions.jl b/src/conversions.jl index 9893e721..0226f036 100644 --- a/src/conversions.jl +++ b/src/conversions.jl @@ -172,7 +172,7 @@ pyany_toany(::Type{PyAny}) = Any pyany_toany(t::Type{T}) where {T<:Tuple} = Tuple{map(pyany_toany, t.types)...} @static if isdefined(Core, :TypeofVararg) # VERSION >= v"1.7.0-DEV.77" # Core.TypeofVararg introduced in https://github.com/JuliaLang/julia/pull/38136 - pyany_toany(T::Core.TypeofVararg) = T === Vararg{PyAny} ? Vararg{Any} : T + pyany_toany(T::typeof(Vararg)) = T === Vararg{PyAny} ? Vararg{Any} : T end # PyAny acts like Any for conversions, except for converting PyObject (below) convert(::Type{PyAny}, x) = x