Getting PyCall tests to work with Julia 1.7 / Core.TypeofVararg

Last night I waged war with PyCall.jl’s tests. Today I have a minimal PR to fix them. I’m writing up the story in case anyone encounters similar issues with Core.TypeofVararg or AOT compilation tests.

https://github.com/JuliaPy/PyCall.jl/pull/877/checks

PyCall’s tests were failing on Julia nightly since the type of Vararg changed to Core.TypeofVararg in Julia nightly (1.7) since there was no method pyany_toany(::Core.TypeofVararg).

MethodError: no method matching pyany_toany(::Core.TypeofVararg)

https://github.com/JuliaPy/PyCall.jl/runs/1669135329#step:10:51

Core.TypeofVararg was introduced in #38136, version v"1.7.0-DEV.77", with commit 80ace52b. Thanks to @ararslan and @simeonschaub for teaching me how to use contrib/commit-name.sh to find this information.

While I thought I had fixed this by adding an if statement to add the appropriate method to PyCall, the AOT tests were still stubbornly failing.

Eventually I figured out that the AOT tests were actually testing master rather than my changes in my pull request since there was a call to pkg"dev PyCall" just before running the tests and the environment had not been changed. It turns out a command line option for --project was missing, and Julia was having trouble finding the version of PyCall cloned a few steps earlier.

Ultimately, I was able to resolve all the issues in few lines of a compact commit.

1 Like

According to JuliaLang/julia#39239 (comment), Core.TypeofVararg should be spelled typeof(Vararg).